版本比较
汉诺塔
正文
增加 4 行删除 4 行
3 行未改动45678891011121314151617171819202194 行未改动1161171181191201201211221231247 行未改动13213313413513613613713813914094 行未改动3 行未改动#include<cstring>#include<iostream>#include<windows.h>using namespace std;char haha=0; char haha=0;int a=2,biu=0; char b,c; int d,e;int ta[11][3]={0};int huhu[200000000]={0},now=0,abc,cba;HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);void play();void col(int now){ if(now==0) SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY);//?-ê? if(now==0) SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY);//?-ê? if(now==1) SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | FOREGROUND_RED);//p1 if(now==2) SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN);//p2 if(now==3) SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_BLUE);//*x,*y if(now==4) SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | FOREGROUND_GREEN);//x,y94 行未改动 ta[11][abc]--; ta[11][cba]++; Sleep(500); system("cls"); printf("%c->%c",huhu[2*i]+65,huhu[2*i+1]+65); printf("%c->%c",huhu[2*i]+65,huhu[2*i+1]+65); print(a); }}void play()7 行未改动 printf(" 这是一个汉诺塔\n");Sleep(200); printf(" 你要移动圆饼 \n");Sleep(200); printf(" 把所有圆饼从a移到c\n");Sleep(200); printf(" 请选择难度(>1,<10)\n");Sleep(200); printf("-----------------------------------\n"); printf("-----------------------------------\n"); scanf("%d",&a); for(int i=0;i<a;i++) { ta[i][0]=a;94 行未改动