C++ program to implement tower of Hanoi || [PROGRAM AND ALGORITHM] - InTerestinG321

C++ program to implement tower of Hanoi || [PROGRAM AND ALGORITHM]

Tower of Hanoi Executable file link available...,

Tower of Hanoi is a puzzle game of mathematics, tower of Hanoi is a puzzle invented at 1883. Tower of Hanoi puzzle game consists of 3 Tower of different sizes and disk. Which can slide onto any Tower

Algorithm :

1.  Start
     Hanoi procedure(disk,source,destination,final)
2.  if disk==1 Then
     Move disk from source to destination
3.  Hanoi(disk -1,source,final,destination)
     Move disk from disk to destination
4.  Hanoi(disk-1,final,destination,source)
     END IF
     End Procedure

tower of Hanoi Profram:

using namespace std;

void tower(int d, char tower1, char tower2,char tower3)
cout<<"shift first disk from tower\t"<<tower1<<"\tto tower"<<tower2<<"\n\n";
} // if close here

tower(d-1,tower1,tower3,tower2); // recursive function call
cout<<"shift first disk from\t"<<tower1<<"\tto tower"<<tower2<<"\n";

tower(d-1,tower3,tower2,tower1);  //recursive function call

int main()
int disk;
cout<<"enter the number of disk\n\n";

cout<<"there are no disks are shifted\n\n";
cout<<"there are"<<disk<<"disk in tower\n\n";

cout<<"\n\n"<<disk<<"\tdisk in tower 1 are shifted to tower 2";
return 0;


Executable Cpp file

How to add and where to add executable cpp file

write a program to implement selection sort || Executable file download link

C++ PROGRAM TO IMPLEMENT STACK USING ARRAY | with executable cpp file

Program to find factorial of Number in C++ | Interesting321

C++ program to find largest of three numbers using inline function

how to install android os to your pc 

how to fix there is something wrong

Program to implement bubble sort

INSTALL G++ COMPILER TO LINUX | C++ Compiler | Full installation process with screenshot

No comments:

Post a Comment