1void towerOfHanoi(int n, char from_rod, char to_rod,char aux_rod)
2{
3 if (n == 0) {
4 return;
5 }
6 towerOfHanoi(n - 1, from_rod, aux_rod, to_rod);
7 cout << "Move disk " << n << " from rod " << from_rod << " to rod " << to_rod << endl;
8 towerOfHanoi(n - 1, aux_rod, to_rod, from_rod);
9}