📄
字号:
#include "iostream.h"
#include "math.h"
#include "链式堆栈类.h"
struct hnot
{
char to;
char help;
char now;
int n;
};
void main()
{
hnot now,next;
char nowh[10];
int i,num;
now.now='A';
now.help='B';
now.to='C';
now.n=10;
num=now.n;
for(i=0;i<=10;i++)
{
nowh[i]='A';
}
stacklist<hnot> hn;
i=0;
hn.push(now);
while(hn.topnum)
{
now=hn.peek();
if (now.n==1)
{
cout<<now.n<<now.now<<"->"<<now.to<<endl;
nowh[now.n]=now.to;
continue;
}
if (now.n>0)
{
if (nowh[now.n-1]==now.help)
{
cout<<now.n<<now.now<<"->"<<now.to<<endl;
nowh[now.n]=now.to;
next.n=now.n-1;
next.to=now.to;
next.help=now.now;
next.now=now.help;
hn.push(next);
continue;
}
else
{
hn.push(now);
next.n=now.n-1;
next.to=now.help;
next.help=now.to;
next.now=now.now;
hn.push(next);
continue;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -