哪位高手可以提供汉洛塔的C++原代码,本人给你100分

来源:百度知道 编辑:UC知道 时间:2024/05/18 02:20:32
要图形界面
还要可以玩的
#include <iostream>
using namespace std;
class Position
{
public:
void move(char getone,char putone);
};

void Position::move(char getone,char putone)
{
cout<<getone<<"-->"<<putone<<endl;
}

class Disk:public Position
{
public:
void hanoi(int n,char one,char two,char three);
};

void Disk::hanoi(int n,char one,char two,char three)
{
void Position::move(char getone,char putone);
if(n==1)
Position::move(one,three);
else
{
Disk::hanoi(n-1,one,three,two);
Position::move(one,three);
Disk::hanoi(n-1,two,one,three);
}
}
void main()
{
int m;
char u;
Disk a;
cout<<"*****欢迎来到汉洛塔游戏*****"<<endl;
cout<<"请输入盘子的个数:"<<endl;
cin>>m;
cout<<"1.选择A为自己来玩\n2.选择B为调用标准的解答\n";<

#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;
class Position
{
public:
void move(char getone,char putone);
};

void Position::move(char getone,char putone)
{
cout<<getone<<"-->"<<putone<<endl;
}

class Disk:public Position
{
public:
void hanoi(int n,char one,char two,char three);
void show(int r,int w,int e);
void shuoming();
void play(int& r1,int& r2,int& r3);
void count(int m);
private:
int *A,*B,*C;
};
void Disk::count(int m)
{
int k;
A=new int[m];
B=new int[m];
C=new int[m];
for(k=0;k<m;k++)
{
A[k]=k+1;
}
}

void Disk::hanoi(int n,char one,char two,char three)
{
void Position::move(char getone,char putone);
if(n==1)
Position::move(one,three);
else
{
Disk::han