?? hanoi.cpp
字號:
#include <iostream.h>
const int disks = 6; // Make this constant much smaller to run program.
void move(int count, int start, int finish, int temp);
/*
Pre: None.
Post: The simulation of the Towers of Hanoi has terminated.
*/
main()
{
move(disks, 1, 3, 2);
}
void move(int count, int start, int finish, int temp)
{
if (count > 0) {
move(count - 1, start, temp, finish);
cout << "Move disk " << count << " from " << start
<< " to " << finish << "." << endl;
move(count - 1, temp, finish, start);
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -