?? hanoi.cpp
字號:
#include<iostream.h>
void Move(char getone,char putone)
{
cout<<getone<<"->"<<putone<<endl;
}
void Hanoi(int n,char one,char two,char three)
{
if(n==1)Move(one,three);
else
{
Hanoi(n-1,one,three,two);
Move(one,three);
Hanoi(n-1,two,three,one);
}
}
void main()
{
int n;
cout<<"Enter the number of plate:"<<endl;
cin>>n;
cout<<"the steps of moving"<<n<<"plates:"<<endl;
Hanoi(n,'A','B','C');
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -