my algo is correct but the execution part ig giving me wrong answer
Tower of hanoi giving wrong answer
#include<bits/stdc++.h> using namespace std; void toh(int n,char source,char aux,char dest) { if(n==0) { return ; } toh(n-1,source,dest,aux); cout<<" Moving ring “<<n<<” from “<<source<<” to "<<dest; toh(n-1,aux,source,dest); } int main() { int n; cin>>n; toh(n,‘A’,‘B’,‘C’); return 0; }
@checkmate112 hey karthik I have corrected your code please next time save your code on ide
you can refer this.
Hey,
As you are not responding to this thread, I am marking your doubt as Resolved for now. Re-open it if required.
Please mark your doubts as resolved in your course’s “ Ask Doubt ” section, when your doubt is resolved.