C语言编写抢三十游戏——源码.doc_第1页
C语言编写抢三十游戏——源码.doc_第2页
C语言编写抢三十游戏——源码.doc_第3页
C语言编写抢三十游戏——源码.doc_第4页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

查看原文内容:/%C0%E1%BA%DB_%B7%C9/blog/item/90b23b51281b8a718435241c.html本程序源码下载: 精华编程专区 目录下载.#include #include #include int temp1,temp2;void main()int select;int rnd,total=0,temp1,temp2;int input(int i);int pcinput(int t);repeat:printf( n);printf( 欢迎登陆抢三十游戏 n);printf( n);printf( 飛度編程小組製作 n);printf( n);printf( n);printf( 1.开始游戏 n);printf( 2.游戏规则 n);printf( 3.退出游戏 n);printf( n);printf( 少年智则国智,少年强则国强,少年进步则国家进步 n);printf( n);printf( 飞度编程划时代,中国才是最厉害 n);printf( n);printf( n);printf( n);printf( 请输入您的选择:);loop:scanf(%d,&select);srand(unsigned)time(NULL);/初始化随机函数;switch(select) case 1: fflush(stdin); rnd=(int)(rand()%2); /随机抽取或 if(rnd=1) printf(n 游戏已经开始,随机结果为:电脑先走第一步n); do total=pcinput(total); temp1=total;if(temp1=30) printf(n 真遗憾,你输了n);printf(n 本次游戏结束n); fflush(stdin); total=0; temp1=0; temp2=0; fflush(stdin); goto repeat; total=input(total); temp2=total;if(temp2=30)printf(n 恭喜你,你赢了n);printf(n 本次游戏结束n); fflush(stdin); total=0; temp1=0; temp2=0; goto repeat; while(temp131|temp231); else if(rnd=0) printf(n 游戏已经开始,随机结果为:请您先走第一步n); do total=input(total); temp2=total;if(temp2=30)printf(n 恭喜你,你赢了n);printf(n 本次游戏结束n); fflush(stdin); total=0; temp1=0; temp2=0; goto repeat; total=pcinput(total); temp1=total;if(temp1=30) printf(n 真遗憾,你输了n);printf(n 本次游戏结束n); fflush(stdin); total=0; temp1=0; temp2=0; goto repeat; while(temp131|temp231); case 2: printf(n规则:两个人轮流报数,第一个人从开始,按顺序报数,他可以只报,也可以报;第二个人接着第一个人报的数再报下去,但最多也只能间隔两个数,而且不能一个数都不报!n); printf(n例如:第一个人报的是,第二个人可报,也可报;若第一个人报了,则第二个人可报,也可报;接下来仍由第一个人接着报,如此轮流下去,谁先报到谁胜!nn); fflush(stdin); goto repeat;case 3: printf(n 请按任意键退出,请稍后nn); break;default: fflush(stdin); printf(n 选择错误,请重新输入您的选择:); goto loop;/玩家算法;int input(int i)int count;do printf(n 请输入要走的步数:); scanf(%d,&count); if(count2|i+count30) fflush(stdin); printf(n 输入错误,请重新输入!n); else printf(n 此时已经走至:%dn,i+count);while(count2|i+count30);return i+count; /返回总共走的步数;/电脑算法;int pcinput(int t)int step;printf(n 此时已经走至:);if(t%3=2) t+; printf(%dn,t); /如求余等于,那么每次走步else if

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论