⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 王敏-6分.txt

📁 这是很不错的计算机算法
💻 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 + -