C++ Programming Blog

 
 
 

Image

 #include<iostream.h>
 #include<conio.h>

 void move(int n,int A,int C,int B)
    {
       if(n==1)
      cout<<\"\\t Move the upper disc from   Stack-\" <<A<< \"   to   Stack-\"
                                  <<C<< \"\\n\";

       else
      {
         move(n-1,A,B,C);
         move(1,A,C,B);
         move(n-1,B,C,A);
      }
    }


 main( )
    {
       clrscr( );

       cout<<\"\\n\\t **************   TOWERS OF HANOI   **************\\n\"<<endl;
       cout<<\" The Mystery of Towers of Hanoi is as follows : \\n\"<<endl;

       move(4,1,3,2);

       cout<<\"\\n\\t *************************************************\\n\"<<endl;

       getch( );
       return 0;
    }

    Related Post:
  1. Program to read a Non-Linear equation in one variable, then evaluate it using Secant Method and display its kD accurate root

  2. Program that reads marks obtained by a student in a test of 100 marks and print pass if marks are greater than or equal to 50

  3. Program that creats a 3D solid object using Rotational Sweep Representatiom Method

  4. Program that provides an example of This pointer

  5. Program to illustrate the implementation of Scaling Transformation along Arbitrary Direction

  6. Program to translate integer numbers given in words into numeric representation

  7. Program of text box

  8. Program that provides an example of class, object and constructors

  9. Program to computes the n_th term of the fibonacci series using Dynamic Programming Technique

  10. Program to illustrate classes with inline functions

  11. Program that take font and background color and text input from a user and display it in center aligned

  12. Program of Shortest Path for Given Source and Destination (using Dijkstras Algo.)

  13. Program that reads a number and displays it with its digits in reverse order (using while loop)

  14. Program to show the 3D Shearing Transformation along x-axis

  15. Program to draw an ellipse using Polynomial Method

  16. Program to illustrate the implementation of Reflection Transformation about the line y=x and y=-x

  17. Program that reads 10 students marks and displays average, lowest and highest marks

  18. Program to read a Non Linear Function, construct and display the Difference Table

  19. Program to show the projection of 3D objects using Standard Perspective Projection w.r.t. an Arbitrary Plane and Center of Projection...

  20. Program to find largest element of an array

 
 
Didn't find what you were looking for? Find more on Program to solve the mystery of Towers of Hanoi using recursion