📄 towers.cpp
字号:
// towers.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <iomanip>
using namespace std;
void dotowers(int,int,int,int);
int main(int argc, char* argv[])
{ int circlecount;
cin>>circlecount;
cout<<"OUTPUT WITH "<<circlecount<<" CIRCLES";
cout<<"CALLED FROM #CIRCLES"<<setw(8)<<"BEGIN"<<setw(8)<<"AUXIL."<<setw(5)<<"end"
<<" INSTRUCTION"<<endl
<<endl;
cout<<"original :";
dotowers(circlecount,1,2,3);
return 0;
}
//*******************************************************************************
void dotowers(int circlecount,int beginpeg,int auxpeg,int endpeg)
{ cout<<setw(6)<<circlecount<<setw(9)<<beginpeg<<setw(7)<<auxpeg<<setw(7)
<<endpeg<<endl;
if(circlecount>0)
{cout<<"from first:";
dotowers(circlecount-1,beginpeg,endpeg,auxpeg);
cout<<setw(58)<<"move circle"<<circlecount<<" from"<<beginpeg<<" to"<<endpeg
<<endl;
cout<<"from second:";
dotowers(circlecount-1,auxpeg,beginpeg,endpeg);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -