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 in 1883. Tower of Hanoi puzzle game consists of 3 Tower of different sizes and disk. Which slide into towers.

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 towert”<<tower1<<“tto tower”<<tower2<<“nn”;
} // if close here

tower(d-1,tower1,tower3,tower2); // recursive function call
cout<<“shift first disk fromt”<<tower1<<“tto tower”<<tower2<<“n”;

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

int main()
int disk;
cout<<“enter the number of disknn”;

cout<<“there are no disks are shiftednn”;
cout<<“there are”<<disk<<“disk in towernn”;

cout<<“nn”<<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

0 thoughts on “C++ program to implement tower of Hanoi || [PROGRAM AND ALGORITHM]”

Leave a Comment