电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

c语言推箱子代码

c语言推箱子代码_第1页
1/20
c语言推箱子代码_第2页
2/20
c语言推箱子代码_第3页
3/20
#include #include void map1();void map2();void map3();void show();void move();void main(int argc,char*argv[]){time_t a,b;time(&a);system("color 1E");loop1:{system("cls");//刷屏printf("\n\n\n\n\n\n\t\t\t\t 欢迎进入推箱子游戏\n\n\t\t\t\t 请按 a b c 选择游戏\n\n\t\t\t\t 按 d 键 结束");int t=getch();if(t=='d'){printf("\n\t\t\t ");}else{if(t=='a'){map1();goto loop1;}if(t=='b'){map2();goto loop1;}if(t=='c'){map3();goto loop1;}else{printf("\n\n\t\t\t\t 请重新输入:");goto loop1;}}}time(&b);printf("\n\n\n\n\t\t\t\t 游戏总共用时%.3d 秒\n\t\t\t ",b-a);getch();//等待读取回车符以结束程序}void map1(){time_t p,q,o;time(&p);int i=4,j=4,m=6,n=2,t=1,k=3;system("cls");//刷屏system("color 2E");int x=1,y=7;char z,a[9][9]={ /*为背景设置初始资料*/{'#','#','#','#','#','#','#','#','#'},{'#','#','#', 3, 0 , 0 , 0 , 1 ,'#'},{'#','#', 0 , 0 , 0 ,'#', 0 ,'#','#'},{'#', 0 , 0 ,'#', 0 , 0 , 5 , 0 ,'#'},{'#', 0 , 5 , 5 , 3 , 0 , 0 , 0 ,'#'},{'#','#', 0 ,'#', 0 , 0 ,'#','#','#'},{'#','#', 3 , 0 , 0 , 0 ,'#','#','#'},{'#','#','#','#','#','#','#','#','#'},{'#','#','#','#','#','#','#','#','#'}};show(a);//调用输出函数loop://语句标号move(a,&x,&y,i,j,m,n,t,k,&z);if(a[i][j]=='!'&&a[m][n]=='!'&&a[t][k]=='!'){system("cls");//刷屏show(a);printf("\t\t\t\t YOU ARE WIN!\n");time(&q);printf("\t\t\t\t\t 用时%.3d 秒\n",q-p);printf("\t\t\t\t*******回车重 新选择*******\n\t\t\t\t");getch();}else{time(&o);if(z=='d'){return;}if(o-p>30){loop1:system("cls");//刷屏printf("\t\t\t\t 时间已过请重新回车选关!");int g=getch();if(g==13)//推断是否为回车符{return;}else{goto loop1;}}system("cls");//刷屏show(a);//调用输出函数goto loop;}}void map2(){ time_t p,q,o;time(&p);int i=2,j=1,m=1,n=3,t=4,k=6;system("cls");//刷屏system("color 2E");int x=4,y=1;char z,b[9][9]={ /*为背景设置初始资料*/{'#','#','#','#','#','#','#','#','#'},{'#','#','#', 3 , 0 ,'#','#','#','#'},{'#', 3 ,'#', 0 , 0 , 0 , ...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

c语言推箱子代码

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部