求给一个C++程序注释!!程序代码如下:谢谢!//后注释即可

来源:百度知道 编辑:UC知道 时间:2024/06/28 20:20:38
#include<iostream.h>
#include<iomanip.h>
#include<stdio.h>//递归法
#include <stack> //堆栈法
using namespace std; //
void context()//菜单
{
cout<<setw(20)<<"-------------------------------------"<<endl;
cout<<setw(20)<<" 汉诺塔 "<<endl;
cout<<setw(10)<<"====================================="<<endl;
cout<<setw(15)<<" 1 递归解法 "<<endl;
cout<<setw(15)<<" 2 非递归解法 "<<endl;
cout<<setw(10)<<" 请选择(1或2,0:退出) "<<endl;
cout<<setw(10)<<"-------------------------------------"<<endl;
}
//递归法定义的函数
static long int m=1;//用来计算移动步骤步数,静态变量才能不断叠加
void hanoi(int n,int a,int b,int c)//
{
if(n==1)
{

#include<iostream.h>
#include<iomanip.h>
#include<stdio.h>// 递归法
#include <stack> // 堆栈法
using namespace std; // 使用命名空间
void context()// 菜单 作为全局函数在主函数中调用
{
cout<<setw(20)<<"-------------------------------------"<<endl;
cout<<setw(20)<<" 汉诺塔 "<<endl;
cout<<setw(10)<<"====================================="<<endl;
cout<<setw(15)<<" 1 递归解法 "<<endl;
cout<<setw(15)<<" 2 非递归解法 "<<endl;
cout<<setw(10)<<" 请选择(1或2,0:退出) "<<endl;
cout<<setw(10)<<"-------------------------------------"<<endl;
}
// 递归法定义的函数
static long int m=1;// 用来计算移动步骤步数,静态变量才能不断叠加
void hanoi(int n,int a,int b,int c)//
{
if(n==1)
{
printf(