UVa 254

From Algorithmist
Jump to navigation Jump to search

void Hanoi(int N, char from, char help, char to)

{

if(N == 1)

cout<<"plate 1 from "<<from<< " to " << to <<endl;

else

{

Hanoi(N-1,from,to,help);

cout<<"Plate " << N <<" from " << from << " to " << to<<endl;

Hanoi(N-1, help, from, to);

}

}

Algoritma Menara Hanoi