ImageVerifierCode 换一换
格式:DOCX , 页数:74 ,大小:27.86KB ,
资源ID:9671635      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/9671635.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(数据结构扫雷实训源代码.docx)为本站会员(b****7)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

数据结构扫雷实训源代码.docx

1、数据结构扫雷实训源代码所需头文件 和 头文件的安装方法请到网上下载/*/* 著作权所有者 : */* 文件名 : 扫雷.cpp */* 内容 : 对排好序的文件进行检索 */* 作成日期 作者 : */* 修正日期 作者 : */*/#include#include #include #include#include#include #includepthread_t thread2;pthread_mutex_t mut;MOUSEMSG m;int *a; /一个用于分配空间的指针int post; /初始化不同等级雷的数量int size; /不同等级分配不同内存空间int shenyu

2、mine; /记录剩余雷的数量int *two; /记录每个位置旁边有多少雷,0代表无雷,9代表当前位置是雷int *twotemp; /记录当前位置是否被鼠标左键点击int *numflags; /记录当前位置鼠标右键是否点击 int timerm=0; /内置计时器 的分钟数int timers=0; /内置计时器 的秒数int controltime=0; int center_x=0;int center_y=0;int classsign=1; /定义游戏等级 且默认状态 为低级int leftdownsign; /记录int gameend; /标记游戏是否结束int return

3、end=0;/标记是否点击返回按钮int restarttimer;/标记是否点击重新开始 以清零计时器clock_t time_start,time_stop; /标记游戏开始到结束所用时间float score; /记录游戏分数int lable; /标签控制鼠标点击时对应的不同页面IMAGE p; /读取图片 鼠标未指向状态IMAGE p11; /读取图片 鼠标指向状态IMAGE p1; /读取图片 鼠标未指向状态IMAGE p21; /读取图片 鼠标指向状态IMAGE p2;IMAGE p31;IMAGE p3;IMAGE p41;IMAGE c;IMAGE c1;IMAGE c11;

4、IMAGE c2;IMAGE c21;IMAGE c3;IMAGE c31;IMAGE f;IMAGE s;IMAGE t;IMAGE restarttemp; /读取图片 鼠标未指向状态IMAGE restart;IMAGE returtemp; /读取图片 鼠标指向状态IMAGE retur;IMAGE zero; /读取旁边地雷数量图标IMAGE one;IMAGE two1;IMAGE three;IMAGE four;IMAGE five;IMAGE six;IMAGE seven;IMAGE eight;IMAGE mine; /读取地雷IMAGE shenyu; /隐蔽计数显示I

5、MAGE suremax; IMAGE suremaxtemp;IMAGE clearrecod;IMAGE clearrecodtemp;void mouseaction();void ginterface();void mianinterface();void random();void addtion();void autoshow(int x,int y,int temp);void autoshowtemp(int x,int y,int temp,int a,int b,int c);void showshenyuminenum();void maxscore(int score,

6、int sign);void thread_create();void clearrecodfile();void suregameend();void autoshowtip(int x,int y,int temp);void autoshowtemptiptemp(int x,int y,int temp,int a,int b,int c);void autoshowreturntemp(int x,int y,int temp,int a,int b,int c) ;void autoshowreturn(int x,int y,int temp);int scanautoshow(

7、int x,int y,int temp);int scanautoshowtemp(int x,int y,int temp,int a,int b,int c);void getclass() /得到游戏等级函数 putimage(270,80,&c); putimage(270,80,&c1); putimage(270,175,&c2); putimage(270,285,&c3); lable=2; mouseaction();void mouseaction() /鼠标控制 游戏界面 int sign=0; /标记鼠标该函数是否退出 int flagsnum=0; /插入旗帜的个数

8、 int temp; /记录当前等级下雷盘的行数 if(classsign=1) temp=6; if(classsign=2) temp=9; if(classsign=3) temp=10; while(1) m=GetMouseMsg(); /得到鼠标当前状态 如没有状态则等待 switch(m.uMsg) case WM_MOUSEMOVE: /移动鼠标 if(lable=1) /主界面 if(m.x=270&m.x=80&m.y=115) /确定鼠标当前位置是否在相应范围内 putimage(270,80,&p11); if(m.x370)|(m.y115) putimage(270

9、,80,&p); if(m.x=270&m.x=220&m.y=255) putimage(270,220,&p21); if(m.x370)|(m.y255) putimage(270,220,&p3); if(m.x=270&m.x=150&m.y=185) putimage(270,150,&p41); if(m.x370)|(m.y185) putimage(270,150,&p2); if(m.x=270&m.x=290&m.y=325) putimage(270,290,&p31); if(m.x370)|(m.y325) putimage(270,290,&p1); if(lab

10、le=2) /等级设置 if(m.x=270&m.x=80&m.y=120) putimage(270,80,&c11); if(m.x370)|(m.y120) putimage(270,80,&c1); if(m.x=270&m.x=175&m.y=215) putimage(270,175,&c21); if(m.x370)|(m.y215) putimage(270,175,&c2); if(m.x=270&m.x=285&m.y=325) putimage(270,285,&c31); if(m.x370)|(m.y325) putimage(270,285,&c3); if(lab

11、le=3) /游戏界面 if(m.x=130&m.x=400&m.y=440) putimage(130,400,&restarttemp); if(m.x250)|(m.y440) putimage(130,400,&restart); if(m.x=350&m.x=400&m.y=440) putimage(350,400,&returtemp); if(m.x470)|(m.y440) putimage(350,400,&retur); if(lable=4) /最高记录界面 if(m.x=150&m.x=400&m.y=380&m.x=400&m.y=270&m.x=220&m.y=2

12、70&m.x=150&m.y=270&m.x=80&m.y=270&m.x=290&m.y=270&m.x=80&m.y=270&m.x=175&m.y=270&m.x=285&m.y=150&m.x=50&m.y=(50+temp*30)&leftdownsign=0&gameend=0) /判断鼠标位置并确定游戏是否结束和 当前位置是否被鼠标左键点击 / printf(%d %d %dn,*(two+(m.x-150)/30)+(m.y-50)/30)*temp),(m.y-50)/30,(m.x-150)/30); if(*(two+(m.x-150)/30)+(m.y-50)/30)*

13、temp)!=9) if(*(two+(m.x-150)/30)+(m.y-50)/30)*temp)=0) / putimage(m.x-150)/30)*30+150,(m.y-50)/30)*30+50,&s); autoshow(m.x,m.y,temp); else if(*(two+(m.x-150)/30)+(m.y-50)/30)*temp)=1&*(twotemp+(m.x-150)/30)+(m.y-50)/30)*temp)=0) *(twotemp+(m.x-150)/30)+(m.y-50)/30)*temp)=1; putimage(m.x-150)/30)*30+

14、150,(m.y-50)/30)*30+50,&one); else if(*(two+(m.x-150)/30)+(m.y-50)/30)*temp)=2&*(twotemp+(m.x-150)/30)+(m.y-50)/30)*temp)=0) *(twotemp+(m.x-150)/30)+(m.y-50)/30)*temp)=1; putimage(m.x-150)/30)*30+150,(m.y-50)/30)*30+50,&two1); else if(*(two+(m.x-150)/30)+(m.y-50)/30)*temp)=3&*(twotemp+(m.x-150)/30)+

15、(m.y-50)/30)*temp)=0) *(twotemp+(m.x-150)/30)+(m.y-50)/30)*temp)=1; putimage(m.x-150)/30)*30+150,(m.y-50)/30)*30+50,&three); else if(*(two+(m.x-150)/30)+(m.y-50)/30)*temp)=4&*(twotemp+(m.x-150)/30)+(m.y-50)/30)*temp)=0) *(twotemp+(m.x-150)/30)+(m.y-50)/30)*temp)=1; putimage(m.x-150)/30)*30+150,(m.y-

16、50)/30)*30+50,&four); else if(*(two+(m.x-150)/30)+(m.y-50)/30)*temp)=5&*(twotemp+(m.x-150)/30)+(m.y-50)/30)*temp)=0) *(twotemp+(m.x-150)/30)+(m.y-50)/30)*temp)=1; putimage(m.x-150)/30)*30+150,(m.y-50)/30)*30+50,&five); else if(*(two+(m.x-150)/30)+(m.y-50)/30)*temp)=6&*(twotemp+(m.x-150)/30)+(m.y-50)

17、/30)*temp)=0) *(twotemp+(m.x-150)/30)+(m.y-50)/30)*temp)=1; putimage(m.x-150)/30)*30+150,(m.y-50)/30)*30+50,&six); else if(*(two+(m.x-150)/30)+(m.y-50)/30)*temp)=7&*(twotemp+(m.x-150)/30)+(m.y-50)/30)*temp)=0) *(twotemp+(m.x-150)/30)+(m.y-50)/30)*temp)=1; putimage(m.x-150)/30)*30+150,(m.y-50)/30)*30

18、+50,&seven); else if(*(two+(m.x-150)/30)+(m.y-50)/30)*temp)=8&*(twotemp+(m.x-150)/30)+(m.y-50)/30)*temp)=0) *(twotemp+(m.x-150)/30)+(m.y-50)/30)*temp)=1; putimage(m.x-150)/30)*30+150,(m.y-50)/30)*30+50,&eight); if(*(numflags+(m.x-150)/30)+(m.y-50)/30)*temp)=1) *(numflags+(m.x-150)/30)+(m.y-50)/30)*temp)=0; shenyumine+; /取消有雷状态 重新计算雷德数量 showshenyuminenum(); suregameend(); else time_stop=clock(); /挖到地雷 游戏结束 计时器得到当前时间 for(int i=0;itemp;i+) for(int j=0;jtemp;j+) if(*(two+temp*i+j)=9) putimage(150+j*30,50+30*i,&mine);

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1