#include void towers_of_hanoi(int height, char from, char to, char use) { if ( height == 1 ) cout << "Move disk from " << from << " to " << to << endl; else { towers_of_hanoi( height - 1, from, use, to); cout << "Move disk from " << from << " to " << to << endl; towers_of_hanoi( height - 1, use, to, from); } } int main () { int number_of_pegs; cout << "Enter the number of disks: "; cin >> number_of_pegs; towers_of_hanoi( number_of_pegs, 'A', 'C', 'B'); }