c++语言-设计打字母小游戏

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

#includeiostream#includewindows.h#includestdlib.h#includetime.h#includeconio.husingnamespacestd;classdazi{public:voidsetpos(intx,inty);voidwelcome();intbody();voidstart();voidabout();//voidend;//intspeed();inttime();};voiddazi::welcome(){for(inti=0;i3;i++){system(cls);cout\n\n\n\n\n\n\n\n\n\n\t\t\tloading;for(intj=0;j10;j++){Sleep(80);cout.;}}do{system(cls);cout\n\nendl;cout\n\t\t\t*********************************endl;cout\n\t\t\t*欢迎挑战*endl;cout\n\t\t\t*********************************endl;//cout\n\t\t\t**endl;cout\n\t\t\t**endl;cout\n\t\t\t*1.进入游戏*endl;cout\n\t\t\t*2.游戏指南*endl;cout\n\t\t\t*4.关于作者*endl;cout\n\t\t\t*5.退出*endl;cout\n\t\t\t**endl;cout\n\t\t\t*********************************endl;cout\n\t\t\t请选择:;inti;cini;switch(i){case1:time();start();body();break;/*case2:general();break;case3:hard();break;case4:about();break;case5:end();break;**/default:cout您的输入有误!按任意键继续......;getchar();getchar();}}while(1);}intdazi::time(){system(cls);cout\n\n\n\n\n\t\t\t\tloading...\n\n\n\n\nendl;for(inti=0;i80;i++){cout;Sleep(20);};return0;}voiddazi::start(){system(cls);inti;for(i=1;i=2;i++){cout|endl;cout*endl;}cout***ZYH***;for(i=9;i=13;i++)cout-*-;coutGOOD***endl;for(i=1;i=8;i++)cout|endl*\n;}voiddazi::setpos(intx,inty){COORDcoord;coord.X=x;coord.Y=y;SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord);}voidsleep(unsignedintmseconds){clock_tgoal=mseconds+clock();while(goalclock());}intdazi::body(){dazishow;inth=20;intw=40;ints=150;intx,y;intc=0,cok=0;charch,k;while(1){ch=rand()%26+'A';x=10+rand()%w;y=5;c++;while(yh){if(_kbhit()){k=getch();if(k==ch||k==ch+32){cok++;break;}}show.setpos(x,y);coutch;sleep(s);show.setpos(x,y);cout'';y++;}show.setpos(0,h+1);cout***GOOD————————————————GOOD***endl;coutcok/ccok*1.0/c*100%endl;;cout***GOOD————————————————GOOD***;}return0;}intmain(){daziA;daziB;daziW;W.welcome();A.start();B.body();system(pause);}

1 / 4
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功