Ok heres my problem i was told to make a simple tower of hanoi project (standard for C++ courses) heres what i have it works pretty well the only problem i have is that i need to number the discs from smallest to largest and tell which is moving. i only have from which tower you move the disc but my teacher wants to know which disc is moving to which tower. can anyone help with this it would be greatly appreciated.
#include<iostream>
#include<cstdlib>
#include<windows.h>
using namespace std;
void T( int, char, char, char);
int main()
{
int n;
const char A = 'A', B = 'B', C = 'C';
cout<<"\n\n\n\n The TOWER OF HANOI" << endl << endl;
cout<<"Enter the Number of Disc: " << endl;
cin >> n;
cout << "The Solution to the Problem is: " << endl;
T(n, A, B, C);
return 0;
}
void T(int n, char A, char B, char C)
{
if(n == 1)
{
cout<<"\nMove Disc from tower "<< A << " to tower "<< C << endl;
}
else
{
T(n-1, A, C, B);
cout<<"\nMove Disc from tower "<< A << " to tower "<< B<< endl;
T(n-1, B, A, C);
}
return ;
}