#include <iostream> using namespace std; void print(char A, char C) { cout << A << "-->" << C << endl; } void hanoi(int n, char A, char B, char C) { if(n == 1) { print(A, C); } else { hanoi(n - 1, A, C, B); print(A, C); hanoi(n - 1, B, A, C); } } int main() { int n; cout << "Please input the number of plates in pile A:"; cin >> n; hanoi(n, 'A', 'B', 'C'); system("pause"); return 0; }