---恢复内容开始---
//n:盘子个数 a,b,c用字符表示三根柱子 void hanoiTower(int n, char a, char b, char c) { static int step = 0; if (n == 1) { cout << ++step<<": "<<a << "→" << c << endl; return; } else { hanoiTower(n - 1, a, c, b); cout << ++step << ": " << a << "→" << c << endl; hanoiTower(n - 1, b, a, c); } }
---恢复内容结束---