c扫雷小游戏
c语言吧
全部回复
仅看楼主
level 1
c闲人 楼主
#include
#include
#include
#define LEFTPRESS 0xff01
#define LEFTCLICK 0xff10#
define LEFTDRAG 0xff19#define MOUSEMOVE 0xff08int num[10][10];/*范围*/int p[10][10];/*统计雷的数组*/int loop;/*重新来的标志*/int again=0;/*是否重来的变量*/int scorenum;/*一开始统计有几个雷*/char score[3];/*输出一共有几个地雷*/int Keystate;int MouseExist;int MouseButton;int MouseX;int MouseY;/*鼠标光标形状定义*/typedef struct { unsigned int shape[32]; char hotx; char hoty; }SHAPE;/*箭头型*/SHAPE ARROW={ { 0x3fff,0x1fff,0x0fff,0x07ff, 0x03ff,0x01ff,0x00ff,0x007f, 0x003f,0x00ff,0x01ff,0x10ff, 0x30ff,0xf87f,0xf87f,0xfc3f, 0x0000,0x7c00,0x6000,0x7000, 0x7800,0x7c00,0x7e00,0x7f00, 0x7f80,0x7e00,0x7c00,0x4600, 0x0600,0x0300,0x0300,0x0180 }, 0,0, };/*鼠标光标显示*/void MouseOn() { _AX=0x01; geninterrupt(0x33); }/*鼠标光标掩示*/void MouseOff()/*鼠标光标隐藏*/ { _AX=0x02; geninterrupt(0x33); }void MouseSetXY(int x,int y)/*设置当前位置*/ { _CX=x; _DX=y; _AX=0x04; geninterrupt(0x33); }int LeftPress()/*左键按下*/ { _AX=0x03; geninterrupt(0x33); return(_BX&1); }void MouseGetXY()/*得到当前位置*/ { _AX=0x03; geninterrupt(0x33); MouseX=_CX; MouseY=_DX; } begain()/*游戏开始画面*/{ int i,j; loop: cleardevice(); MouseOn(); MouseSetXY(180,30); MouseX=180; MouseY=30; scorenum=0; setfillstyle(SOLID_FILL,7); bar(190,60,390,290); setfillstyle(SOLID_FILL,8); for(i=100;i<300;i+=20)/*画格子*/ for(j=200;j<400;j+=20) bar(j-8,i+8,j+8,i-8); setcolor(7); setfillstyle(SOLID_FILL,YELLOW);/*画脸*/ fillellipse(290,75,10,10); setcolor(YELLOW); setfillstyle(SOLID_FILL,0); fillellipse(285,75,2,2); fillellipse(295,75,2,2); setcolor(0); bar(287,80,293,81); randomize(); for(i=0;i<10;i++) for(j=0;j<10;j++) { num[i][j]=random(7)+10;/*用10代表地雷算了*/ if(num[i][j]==10) scorenum++; } sprintf(score,"%d",scorenum); setcolor(1); settextstyle(0,0,2); outtextxy(210,70,score); scorenum=100-scorenum;/*为了后面判断胜利*/}gameove()/*游戏结束画面*/{ int i,j; setcolor(0); for(i=0;i<10;i++) for(j=0;j<10;j++) if(num[i][j]==10)/*是地雷的就显示出来*/ { setfillstyle(SOLID_FILL,RED); bar(200+j*20-8,100+i*20-8,200+j*20+8,100+i*20+8); setfillstyle(SOLID_FILL,0); fillellipse(200+j*20,100+i*20,7,7); }}int tongji(int i,int j)/*计算有几个雷*/{ int x=0;/*10代表地雷*/ if(i==0&&j==0) { if(num[0][1]==10) x++; if(num[1][0]==10) x++; if(num[1][1]==10) x++; } else if(i==0&&j==9) { if(num[0][8]==10) x++; if(num[1][9]==10) x++; if(num[1][8]==10) x++; } else if(i==9&&j==0) { if(num[8][0]==10) x++; if(num[9][1]==10) x++; if(num[8][1]==10) x++; } else if(i==9&&j==9) { if(num[9][8]==10) x++; if(num[8][9]==10)
2004年08月19日 16点08分 1
level 0
好猛~~~~~~~~~~~~!
2005年04月08日 12点04分 3
level 0
不知道楼主从哪里抄的?
2005年04月08日 21点04分 4
level 0
好多啊。输入要浪费好多时间和精神啊。
2005年04月09日 02点04分 5
level 1
经典!
2005年04月09日 12点04分 6
level 0
可以直接复制到记事本,在用TC打开啊
2005年04月24日 04点04分 7
level 0
爽!!!!没想到TC也能写出这摸好的游戏来
2005年04月24日 05点04分 8
level 0
我觉得这种东西没有必要贴出来,没有几个人会耐心的看完的
2005年04月24日 05点04分 9
level 0
狂人!!!!!!1
2005年04月24日 13点04分 10
level 0
我会的
2005年04月25日 05点04分 11
level 0
我的意思是我会仔细看的
2005年04月25日 05点04分 12
level 1
请问我在VC6.0下运行该程序怎么说找不到:
?
2005年04月28日 01点04分 13
level 0
swRZWE TKHMJGJL,XCFBJL;IO['RDFGFGKHIGOPTYR43EYG
2005年04月28日 02点04分 14
level 0
13 回复:c扫雷小游戏 请问我在VC6.0下运行该程序怎么说找不到:
? 13楼的'高手'请了: 你把tc的代码(而且是包括tc文件名的代码)放到vc6.0里运行了?你真高啊高的我看你都眼晕你怎么不把c代码放到.net里运行?
2005年06月14日 00点06分 15
level 0
符合标准库的C是可以的
是TC2的扩展库,就不行
2005年06月14日 05点06分 16
level 1
无论是作者还是给大家解决难题的人都是令小女子佩服的人如果给该程序写论文该怎么写啊???我有好多还没看懂呢?我运行出现了一个错误,那又是为什么呢??谁能帮帮我啊~QQ:64866757
2005年06月27日 06点06分 17
level 1
谢谢大家了~
2005年06月27日 06点06分 18
level 0
炸的了
2005年06月29日 02点06分 19
level 0
哪个这么狂啊
2005年06月29日 02点06分 20
level 0
真不错
2005年06月30日 13点06分 21
1 2 3 4 5 6 尾页