📄 王敏-6分.txt
字号:
#include<fstream.h>
void move(int n,char a,char b,ofstream& out1)
{
out1<<n<<' '<<a<<' '<<b<<'\n';
}
void hanoi(int n,char a,char b,char c,ofstream& out1)
{
if (n>0)
{
hanoi(n-1,a,c,b,out1);
move(n,a,b,out1);
hanoi(n-1,c,b,a,out1);
}
}
void main()
{
int n;
char A='A',B='B',C='C';
ifstream fin("input.txt");
fin>>n;
ofstream out1("output.txt");
hanoi(n,A,B,C,out1);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -