大一刚接触编程时写的一个Dos界面的智力游戏,没什么技术含量,而且那时候代码里C和C++混用比较严重,后来意识到这一点很不好。当时主要是想把学的东西运用一下,轻喷。
cpp下载地址:http://download.csdn.net/detail/doleria/8540397
游戏破解文本:http://download.csdn.net/detail/doleria/8540407
#include<iostream>
#include<windows.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
#include<time.h>
using namespace std;
static int i=0;
static unsigned holdrand=1L;
static int t1,t2,t3,t4,t5,t6,t7,t8;
//产生随机数,为后面第一关提供数字
void mysrand(unsigned seed)
{
holdrand=seed;
}
int myrand(void)
{
return(((holdrand=holdrand*214013L+2531011L)>>16)&0x7fff);
}
void Menu()
{
system("cls");
cout<<"################################"<<endl;
cout<<"# 1.start the game #"<<endl;
cout<<"# 2.introduction #"<<endl;
cout<<"# 3.about me #"<<endl;
cout<<"# 4.exit #"<<endl;
cout<<"################################"<<endl;
}
void stepmenu()
{
system("cls");
cout<<"Now give me UR choice:"<<endl;
cout<<"1.continue the next step"<<endl;
cout<<"2.back to the game menu"<<endl;
}
void step9()
{
char name0[20],path[20];
FILE *fp;
system("cls");
cout<<"loading.";Sleep(500);system("cls");cout<<"loading..";Sleep(500);system("cls");cout<<"loading...";Sleep(500);system("cls");cout<<"loading....";Sleep(500);system("cls");cout<<"loading.....";Sleep(500);system("cls");cout<<"loading......";Sleep(500);system("cls");
cout<<" ______ "<<endl;
cout<<"|step 9|"<<endl;
cout<<"~~~~~~~~"<<endl;
cout<<"You :Oh my god!终于找到你了!!!好高兴啊!"<<endl;Sleep(1500);
cout<<"kate:( ⊙o⊙ )哇!!!你居然来救我了,真是太感动了!!!太感谢你啦!!!"<<endl;Sleep(1500);
cout<<"You :呵呵,小意思啦!(其实你不知道我被那个Joish整得有多惨!)"<<endl;Sleep(1500);
cout<<"至此,你已经完成了所有任务!恭喜你,成功过关!"<<endl;
cout<<"请再次输入您的姓名:";cin>>name0;
cout<<"为了保存您的游戏记录,请在此输入存储记录的路径(格式如:D:\\record.txt):"<<endl;cin>>path;
fp=fopen(path,"w+");
fprintf(fp,"%s的游戏记录:\n",name0);
fprintf(fp,"step1 总共进行了%d次\n",t1);
fprintf(fp,"step2 总共进行了%d次\n",t2);
fprintf(fp,"step3 总共进行了%d次\n",t3);
fprintf(fp,"step4 总共进行了%d次\n",t4);
fprintf(fp,"step5 总共进行了%d次\n",t5);
fprintf(fp,"step6 总共进行了%d次\n",t6);
fprintf(fp,"step7 总共进行了%d次\n",t7);
fprintf(fp,"step8 总共进行了%d次\n",t8);
fprintf(fp,"非常感谢您的游戏体验!");
fclose(fp);
cout<<"游戏记录已成功保存!您可以在"<<path<<"中查看..."<<endl;Sleep(1500);
cout<<"非常感谢您的游戏体验..."<<endl;Sleep(1500);
cout<<"5秒后将跳转至游戏菜单界面..."<<endl;Sleep(5000);
}
void step8()
{
static int _time;static int count1;int times0;
system("cls");
if(count1==0)
{
cout<<"loading.";Sleep(500);system("cls");cout<<"loading..";Sleep(500);system("cls");cout<<"loading...";Sleep(500);system("cls");cout<<"loading....";Sleep(500);system("cls");cout<<"loading.....";Sleep(500);system("cls");cout<<"loading......";Sleep(500);system("cls");
}
else
{system("cls");}
cout<<" ______ "<<endl;
cout<<"|step 8|"<<endl;
cout<<"~~~~~~~~"<<endl;
cout<<"情景:你进入诡异的房间后,却没有发现kate的身影,"<<endl;
cout<<" 只是房间里突然唱起了backstreetboys的《evergreen》...你瞬间石化..."<<endl;
Sleep(3000);
system("cls");
cout<<"歌词如下:"<<endl;
cout<<"I've been on the run slept under the sun "<<endl;
cout<<"feeding off the clouds and eating them like ice cream I've been all around"<<endl;
cout<<"never left this town blisters on my eyelids like it's spring in paris"<<endl;
cout<<"I've seen everything I've dreamt every dream I am every human"<<endl;
cout<<"Oh I'm not even finished Look how I go Impeccable flow "<<endl;
cout<<"wind in my face it hardly ever rains"<<endl;
cout<<"always on top I'm everything and I am everything I am evergreen!"<<endl;
Sleep(20000);
cout<<"你觉得在诡异的房间里听到backstreetboys的歌已经够奇葩的了,可是接下来"<<endl;
cout<<"密室里传来的声音让你顿时被石化..."<<endl;
Sleep(4000);
system("cls");
if(_time==0||_time==3)
{
cout<<"刚才的歌词里出现了多少个‘I’,(只算含义为‘我’的‘I’)"<<endl;
_time++;
cout<<"Your answer:";cin>>times0;
if(times0==10)
{
t8++;
cout<<"突然kate出现在了你身旁..."<<endl;
//解开下一关。
i++;
Sleep(2000);
char in1;int stepexit=0;
while(!stepexit)
{
stepmenu();
in1=getch();
switch(in1)
{
case '1':stepexit=1;step9();break;
case '2':stepexit=1;break;
default:cout<<"U've pressed a wrong key,press any key to choose again!"<<endl;getch();break;
}
}
}
else
{
t8++;
cout<<"哈哈,最后了可没这么简单......"<<endl;
Sleep(1500);
step8();
}
}
else
{
cout<<"刚才的歌词里出现了多少个‘the’"<<endl;
_time++;
cout<<"Your answer:";cin>>times0;
if(times0==3)
{
t8++;
cout<<"突然kate出现在了你身旁..."<<endl;
//解开下一关。
i++;
Sleep(2000);
char in1;int stepexit=0;
while(!stepexit)
{
stepmenu();
in1=getch();
switch(in1)
{
case '1':stepexit=1;step9();break;
case '2':stepexit=1;break;
default:cout<<"U've pressed a wrong key,press any key to choose again!"<<endl;getch();break;
}
}
}
else
{
t8++;
cout<<"哈哈,最后了可没这么简单......"<<endl;
Sleep(1500);
step8();
}
}
}
void step7()
{
int num;
system("cls");
cout<<" ______ "<<endl;
cout<<"|step 7|"<<endl;
cout<<"~~~~~~~~"<<endl;
cout<<"情景:进入密室后,你发现一个屏幕,于是你立即走了过去,这时屏幕上出现一幅地图。";Sleep(3000);system("cls");
cout<<" | |*kate "<<endl;
cout<<"|~~~~~~~~~~~~~~~~~~~~~~~| |~~~~~~~~~~~~~~~~~~~~~~~~~|"<<endl;
cout<<"| ______________________ ________________________ |"<<endl;
cout<<"| | | | | |"<<endl;
cout<<"| | | | | |"<<endl;
cout<<"| | | | | |"<<endl;
cout<<"| | | | | |"<<endl;
cout<<"| | | | | |"<<endl;
cout<<"| | | | | |"<<endl;
cout<<"| | | | | |"<<endl;
cout<<"| | | | | |"<<endl;
cout<<"| | | | | |"<<endl;
cout<<"| |____________________| |______________________| |"<<endl;
cout<<"|______________________ ________________________|"<<endl;
cout<<" | | "<<endl;
cout<<" | | "<<endl;
cout<<" | | "<<endl;
cout<<"|~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~|"<<endl;
cout<<"| ______________________ ________________________ |"<<endl;
cout<<"| | | | | |"<<endl;
cout<<"| | | | | |"<<endl;
cout<<"| | | | | |"<<endl;
cout<<"| | | | | |"<<endl;
cout<<"| | | | | |"<<endl;
cout<<"| | | | | |"<<endl;
cout<<"| | | | | |"<<endl;
cout<<"| | | | | |"<<endl;
cout<<"| | | | | |"<<endl;
cout<<"| |____________________| |______________________| |"<<endl;
cout<<"|______________________ ________________________|"<<endl;
cout<<" | | "<<endl;
cout<<" | | "<<endl;
cout<<" | |*You "<<endl;
Sleep(6000);
system("cls");
cout<<"突然屏幕上的地图消失了,烦人的Joish再次出现了..."<<endl;
cout<<"Joish:哈哈,知道从你现在的位置到kate被关的房间有几种不同的路径选择吗?"<<endl;
cout<<"你毫不犹豫地答道:";cin>>num;
if(num==9)
{
t7++;
cout<<"你选择了一条最佳路径赶快去营救kate..."<<endl;
//解开下一关。
i++;
Sleep(2000);
char in1;int stepexit=0;
while(!stepexit)
{
stepmenu();
in1=getch();
switch(in1)
{
case '1':stepexit=1;step8();break;
case '2':stepexit=1;break;
default:cout<<"U've pressed a wrong key,press any key to choose again!"<<endl;getch();break;
}
}
}
else
{
t7++;
cout<<"你被推出了密室门外......"<<endl;
Sleep(1500);
step7();
}
}
void step6()
{
FILE *fp;
char code[20];
system("cls");
cout<<" ______ "<<endl;
cout<<"|step 6|"<<endl;
cout<<"~~~~~~~~"<<endl;
cout<<"情景:你终于摆脱了Joish的纠缠,但你知道kate肯定被关在了城堡的某个诡异的房间里,"<<endl;
cout<<" 于是你立即跑了进去..."<<endl;Sleep(3500);
system("cls");
cout<<"loading.";Sleep(500);system("cls");cout<<"loading..";Sleep(500);system("cls");cout<<"loading...";Sleep(500);system("cls");cout<<"loading....";Sleep(500);system("cls");cout<<"loading.....";Sleep(500);system("cls");cout<<"loading......";Sleep(500);system("cls");
cout<<"在入口处,你发现了一个石碑,上面就只有两个字..."<<endl;Sleep(1500);
cout<<"========="<<endl;
cout<<"|盘C在放|"<<endl;
cout<<"========="<<endl;Sleep(3000);
system("cls");
cout<<"你觉得很奇怪,明明有四个字呀?!但还是走了进去..."<<endl;
cout<<"刚进门就发现了一个密室,你很好奇,想要进去看看,这时密室的门上显示了这样一段话:"<<endl;Sleep(3000);
system("cls");
cout<<"======================"<<endl;
cout<<"| Enter the password |"<<endl;
cout<<"======================"<<endl;
fp=fopen("C:\\I am not the code.txt","w+");
fprintf(fp,"1q2w3e4r5t6y7u8i9o");
fclose(fp);
cout<<"Enter:";cin>>code;
if(strcmp("1q2w3e4r5t6y7u8i9o",code)==0)
{
t6++;
system("cls");
cout<<"================================="<<endl;
cout<<"| 密室门已被打开! |"<<endl;
cout<<"================================="<<endl;
//解开下一关。
i++;
Sleep(1500);
char in1;int stepexit=0;
while(!stepexit)
{
stepmenu();
in1=getch();
switch(in1)
{
case '1':stepexit=1;step7();break;
case '2':stepexit=1;break;
default:cout<<"U've pressed a wrong key,press any key to choose again!"<<endl;getch();break;
}
}
}
else
{
t6++;
system("cls");
cout<<"================================="<<endl;
cout<<"| 密码输入错误!! |"<<endl;
cout<<"================================="<<endl;
Sleep(1500);
step6();
}
}
void step5()
{
char faith[20];
system("cls");
cout<<" ______ "<<endl;
cout<<"|step 5|"<<endl;
cout<<"~~~~~~~~"<<endl;
cout<<"Joish:你都走了这么久了?你有没有想过是什么支持你走到现在?"<<endl;Sleep(2500);
cout<<"You :当然!我的心中有信念!告诉你吧!那就是:"<<endl;
cout<<" (提示:类似亲情之类的词语,但此处请输入英文)"<<endl;Sleep(2000);
cin>>faith;
if(strcmp("friendship",faith)==0)
{
t5++;
cout<<"Joish:啊!!!中枪了!!!(疑似倒地状...)"<<endl;Sleep(1500);
cout<<"You :哈哈哈哈哈哈!!!"<<endl;
//解开下一关。
i++;
Sleep(1500);
char in1;int stepexit=0;
while(!stepexit)
{
stepmenu();
in1=getch();
switch(in1)
{
case '1':stepexit=1;step6();break;
case '2':stepexit=1;break;
default:cout<<"U've pressed a wrong key,press any key to choose again!"<<endl;getch();break;
}
}
}
else
{
t5++;
cout<<"Joish:你到底想要告诉我什么呀?!"<<endl;
Sleep(1500);
step5();
}
}
void step4()
{
system("cls");
cout<<" ______ "<<endl;
cout<<"|step 4|"<<endl;
cout<<"~~~~~~~~"<<endl;
cout<<"哈哈,经历了前面几关,想必你是看到了Joish有多刁钻,但是,这仅仅是个开始,后面可能还会有更让你头疼的问题..."<<endl;Sleep(2000);
cout<<"这一关正如标题写的那样,是给你提供后面关卡通过的线索的,好了,记住下面我给你说的:"<<endl;Sleep(1000);
cout<<" 电脑磁盘 排列组合 词语搜寻"<<endl;Sleep(1000);
cout<<"祝你过关!"<<endl;Sleep(2000);
i++;
t4++;
cout<<"loading.";Sleep(500);system("cls");cout<<"loading..";Sleep(500);system("cls");cout<<"loading...";Sleep(500);system("cls");cout<<"loading....";Sleep(500);system("cls");cout<<"loading.....";Sleep(500);system("cls");cout<<"loading......";Sleep(500);system("cls");
step5();
}
void step3()
{
int times1;
system("cls");
cout<<" ______ "<<endl;
cout<<"|step 3|"<<endl;
cout<<"~~~~~~~~"<<endl;
cout<<"Joish:既然你想救出你的朋友,就得听我的!现在把Enter键按19次,"<<endl;
cout<<" 自己计数啊!不能少啊!"<<endl;Sleep(2000);
cout<<"You :拜托。。。好吧。。。服你了!!!"<<endl;
//按键以及响铃
getch();getch();cout<<"\a";getch();getch();cout<<"\a";getch();cout<<"\a";getch();cout<<"\a";getch();getch();getch();cout<<"\a";getch();cout<<"\a";getch();getch();getch();cout<<"\a";getch();getch();cout<<"\a";getch();getch();getch();cout<<"\a";getch();
system("cls");
cout<<"Joish:刚才听见几声响铃声?"<<endl;
cout<<"Your answer:";cin>>times1;
if(times1==9)
{
t3++;
cout<<"Joish:呵呵,看来你听得还挺仔细的嘛!"<<endl;Sleep(1500);
cout<<"You :那是!!!"<<endl;
//解开下一关。
i++;
Sleep(1500);
char in1;int stepexit=0;
while(!stepexit)
{
stepmenu();
in1=getch();
switch(in1)
{
case '1':stepexit=1;step4();break;
case '2':stepexit=1;break;
default:cout<<"U've pressed a wrong key,press any key to choose again!"<<endl;getch();break;
}
}
}
else
{
t3++;
cout<<"Joish: 就知道你没注意这个!竖起耳朵仔细听!"<<endl;
Sleep(1500);
step3();
}
}
void step2()
{
char word1[20],word2[20],word3[10];
system("cls");
system("cls");
cout<<" ______ "<<endl;
cout<<"|step 2|"<<endl;
cout<<"~~~~~~~~"<<endl;
cout<<"Joish:哈哈,听说你是个大学生。想必正准备四六级呢吧?敢不敢让我考你几个单词?要是"<<endl;
cout<<" 答对了,就算你过了..."<<endl;Sleep(3000);
cout<<"You :呵呵,这个也想难到我,好简单的一关,放马过来,so easy!!!"<<endl;Sleep(1500);
system("cls");
cout<<"业余爱好者:";cin>>word1;
cout<<"爱国的:";cin>>word2;
cout<<"豹:";cin>>word3;
if(strcmp("amateur",word1)==0&&strcmp("patriotic",word2)==0&&strcmp("leopard",word3)==0||strcmp("panther",word3)==0)
{
t2++;
cout<<"Joish:呵呵,看来你不错嘛!保佑你四六级必过..."<<endl;
//解开下一关。
i++;
Sleep(1500);
char in1;int stepexit=0;
while(!stepexit)
{
stepmenu();
in1=getch();
switch(in1)
{
case '1':stepexit=1;step3();break;
case '2':stepexit=1;break;
default:cout<<"U've pressed a wrong key,press any key to choose again!"<<endl;getch();break;
}
}
}
else
{
t2++;
cout<<"Joish: 哈哈,不会了吧?快去翻字典吧..."<<endl;
Sleep(1500);
step2();
}
}
void step1()
{
static int p=3;int pn[10],in1;
system("cls");
cout<<" ______ "<<endl;
cout<<"|step 1|"<<endl;
cout<<"~~~~~~~~"<<endl;
cout<<"情景:你在去往城堡的路上碰到了Joish,他挡住了你的去路..."<<endl;Sleep(1500);
cout<<"Joish:看来你还有点义气嘛!想救你的朋友,先回答我一个问题再说。"<<endl;Sleep(2000);
cout<<"You :少废话,出题吧!!!"<<endl;Sleep(1500);
system("cls");
cout<<"Joish:看我给你的一串数字:"<<endl;Sleep(1000);
mysrand((unsigned)time(NULL));
for(int m=0;m<10;m++)
{
pn[m]=myrand();
pn[m]=pn[m]%99+1;
}
cout<<pn[0];cout<<" ";Sleep(1000);cout<<pn[1];cout<<" ";Sleep(1000);cout<<pn[2];cout<<" ";Sleep(1000);cout<<pn[3];cout<<" ";Sleep(1000);cout<<pn[4];cout<<" ";Sleep(1000);cout<<pn[5];cout<<" ";Sleep(1000);cout<<pn[6];cout<<" ";Sleep(1000);cout<<pn[7];cout<<" ";Sleep(1000);cout<<pn[8];cout<<" ";Sleep(1000);cout<<pn[9];cout<<" ";Sleep(1000);
Sleep(2000);
system("cls");
cout<<"Joish:呵呵,你记住第"<<p<<"个数字是几了吗?答对了就算你过关!"<<endl;Sleep(800);
cout<<"Input the number:";cin>>in1;
/*--p;
cout<<p;
getch();*/
if(in1==pn[--p])
{
//记录次数
t1++;
cout<<"Joish:不错嘛!算你过了..."<<endl;
//解开下一关。
i++;
Sleep(1000);
char in1;int stepexit=0;
while(!stepexit)
{
stepmenu();
in1=getch();
switch(in1)
{
case '1':stepexit=1;step2();break;
case '2':stepexit=1;break;
default:cout<<"U've pressed a wrong key,press any key to choose again!"<<endl;getch();break;
}
}
}
else
{
t1++;
p+=2;
cout<<"Joish:哈哈哈哈哈哈哈,不行吧你!再给你一次机会...";
Sleep(1000);
step1();
}
}
void step0()
{
char name[20];
system("cls");
cout<<" Welcome to the game:《Save My Friend》! "<<endl<<endl;
cout<<" Please enter your name first:";
cin>>name;
system("cls");
cout<<" kate and "<<name<<" are very close friends.They live in the place which is called ";
Sleep(2000);
cout<<"fantastical kingdom.The reason why we call it like this is that there are many ";
Sleep(2000);
cout<<"strange enchanters living there.They often make the ordinary people get into trouble."<<endl;Sleep(2000);
cout<<" But to some way,their intentions are not so bad as you can imagine.Just ";Sleep(2000);
cout<<"strange,or sometimes even kinda childish ... "<<endl;Sleep(2000);
cout<<" One day,kate was caught by the hurricane.No doubt that this is Joish playing ";Sleep(2000);
cout<<"games.What you need to do now is to go to the Joish's castle to save your friend kate!"<<endl;Sleep(2000);
cout<<" Now let's begin!"<<endl;cout<<endl<<endl;Sleep(2000);
cout<<" press any key to continue... "<<endl;
i++;
getch();
system("cls");
//以下语句是使loading中的点产生动态效果(哈哈,这个我觉得我做的弱爆了,呵呵,实在想不出其他办法。。。)
cout<<"loading.";Sleep(500);system("cls");cout<<"loading..";Sleep(500);system("cls");cout<<"loading...";Sleep(500);system("cls");cout<<"loading....";Sleep(500);system("cls");cout<<"loading.....";Sleep(500);system("cls");cout<<"loading......";Sleep(500);system("cls");
system("cls");
step1();
}
void Introduction()
{
system("cls");
cout<<"|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|";
cout<<"| 游戏介绍 |";
cout<<"| 这是一款关于记忆,注意力,有点刁钻的Dos界面游戏,由于开发者仅有浅显的C,C++知 |";
cout<<"|识,所以源代码中难免会有很多冗杂的部分,可能有些问题的处理也不是很简便,而且游 |";
cout<<"|戏难免会存在很多问题,很欢迎您提出宝贵的意见及建议,联系方式详见主菜单中的 |";
cout<<"|about me选项。 |";
cout<<"| 在您进行游戏期间,请不要关掉此窗口,否则游戏将不能记录您的进度,需要重新开|";
cout<<"|始. |";
cout<<"| 游戏操作很简单,您只需要按照游戏的提示,操作您的键盘即可。希望您能收获乐趣|";
cout<<"| |";
cout<<"| |";
cout<<"| |";
cout<<"| |";
cout<<"| 开发者:刘宇宁|";
cout<<"| 2012年5月 |";
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
cout<<"\n\n\n按任意键进入人物介绍界面... "<<endl;
getch();
system("cls");
cout<<"人物介绍:"<<endl;
cout<<"Joish:"<<endl;
cout<<" 喜欢刁难别人,但却并没有恶意。他喜欢将别人用飓风抓走,然后刁难赶来营救的人,他刁难别人的问题大多集中在记忆力,注意力,当然还有你意想不到的问题上。哈哈,毕竟他上辈子是一个中国学生..."<<endl;
cout<<"\n\n 在游戏过程中如果没有提示,您无需按任何键,您只需要耐心阅读给出的情景提示即可,程序会自动跳转至下一个操作界面。否则,由于您没有耐心而不断地按键可能会使游戏出现一些故障。其实等的时间也不是很长,我倒觉得有点快,呵呵。还有,如果您使用汉字,请及时切换输入法至英文输入。感谢您的合作..."<<endl;
cout<<"Press any key back to the main menu..."<<endl;
getch();
}
void Aboutme()
{
system("cls");
cout<<"******************************************************************"<<endl;
cout<<"* I am a student in Southwest Jiaotong University *"<<endl;
cout<<"* Contact me by QQ:1763504672 or using E-mail *"<<endl;
cout<<"* E-mail address:1763504672@qq.com *"<<endl;
cout<<"******************************************************************"<<endl;
cout<<"Now press any key back to the main menu... "<<endl;
getch();
}
void GameMenu()
{
system("cls");
cout<<"====================================================="<<endl;
cout<<"| 0.step0:Welome. |"<<endl;
cout<<"| 1.step1:Remember the number. |"<<endl;
cout<<"| 2.step2:You like CET? |"<<endl;
cout<<"| 3.step3:Ring the bell. |"<<endl;
cout<<"| 4.step4:Clue. |"<<endl;
cout<<"| 5.step5:Think about it! |"<<endl;
cout<<"| 6.step6:Find the code |"<<endl;
cout<<"| 7.step7:The way to the castle. |"<<endl;
cout<<"| 8.step8:Evergreen. |"<<endl;
cout<<"| 9.step9:I've got you! |"<<endl;
cout<<"| o.I just wanna exit! |"<<endl;
cout<<"====================================================="<<endl;
}
void main()
{
int Exit=0;char in;
while(!Exit)
{
static int count=0;
system("cls");
if(count==0)
{
Menu();
cout<<"\n\n\n强烈建议您先选择‘2’,阅读introduction,以便对游戏有初步了解... "<<endl;
count++;
}
else
Menu();
in=getch();
switch(in)
{
case '1':
{int gameexit=0;
while(!gameexit)
{
system("cls");
GameMenu();
in=getch();
switch(in)
{
case '0':system("cls");step0();break;
case '1':
if(i<1)
{
//这块儿这些语句本来想写个函数直接调用的,最后一不小心就采用了复制粘贴技术,代码有点冗杂,额。。。
cout<<"Step0 is not finished,so U can't jump to step1 directly.\npress any key back to the game menu..."<<endl;
getch();
}
else
{
system("cls");step1();
}
break;
case '2':
if(i<2)
{
cout<<"Step1 is not finished,so U can't jump to step2 directly.\npress any key back to the game menu..."<<endl;
getch();
}
else
{
system("cls");step2();
}
break;
case '3':
if(i<3)
{
cout<<"Step2 is not finished,so U can't jump to step3 directly.\npress any key back to the game menu..."<<endl;
getch();
}
else
{
system("cls");step3();
}
break;
case '4':
if(i<4)
{
cout<<"Step3 is not finished,so U can't jump to step4 directly.\npress any key back to the game menu..."<<endl;
getch();
}
else
{
system("cls");step4();
}
break;
case '5':
if(i<5)
{
cout<<"Step4 is not finished,so U can't jump to step5 directly.\npress any key back to the game menu..."<<endl;
getch();
}
else
{
system("cls");step5();
}
break;
case '6':
if(i<6)
{
cout<<"Step5 is not finished,so U can't jump to step6 directly.\npress any key back to the game menu..."<<endl;
getch();
}
else
{
system("cls");step6();
}
break;
case '7':
if(i<7)
{
cout<<"Step6 is not finished,so U can't jump to step7 directly.\npress any key back to the game menu..."<<endl;
getch();
}
else
{
system("cls");step7();
}
break;
case '8':
if(i<8)
{
cout<<"Step7 is not finished,so U can't jump to step8 directly.\npress any key back to the game menu..."<<endl;
getch();
}
else
{
system("cls");step8();
}
break;
case '9':
if(i<9)
{
cout<<"Step8 is not finished,so U can't jump to step9 directly.\npress any key back to the game menu..."<<endl;
getch();
}
else
{
system("cls");step9();
}
break;
case 'o':gameexit=1;break;
default:cout<<"U've pressed a wrong key,press any key to choose again!"<<endl;getch();break;
}
}
}
break;
case '2':system("cls");Introduction();break;
case '3':system("cls");Aboutme();break;
case '4':
{
system("cls");
cout<<"Do you really want to quit the game?\nOnce you do so,your track record will disappear."<<endl;
cout<<"============================================="<<endl;
cout<<"| 1.Yes,I don't care... |"<<endl;
cout<<"| 2.hmm,I just pressed a wrong button |"<<endl;
cout<<"============================================="<<endl;
char ina;
ina=getch();
if(ina=='1')
{Exit=1;break;}
else if(ina=='2')
break;
//这一句是因为实在不想写while循环了。。。。。。
else
{cout<<"不按要求操作,罚你出局!!!"<<endl;Sleep(2000);Exit=1;break;}
}
default:cout<<"U've pressed a wrong key,press any key to choose again!"<<endl;getch();break;
}
}
}