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

📄 hanoi.txt

📁 Visual C++的课件和一些习题及答案
💻 TXT
字号:
#include <iostream.h>
void move(char a,char b)
{   cout<<"Move "<<a<<"to"<b<<endl;}

void hanoi(int n,char A,char B,char C)
{
	if(n==1)move(A,C);
	else{
	     hanoi(n-1,A,C,B);
		 move(A,C);
		 hanoi(n-1,B,A,C);
	}
}
void main(void)
{
	int n;
	cout<<"Input number of plates!";
	cin>>n;
	cout<<endl;
	hanoi(n,'A','B','C');
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -