| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 463 人关注过本帖
标题:迫不得已!
只看楼主 加入收藏
fancysea
Rank: 1
等 级:新手上路
帖 子:49
专家分:0
注 册:2005-9-3
收藏
 问题点数:0 回复次数:4 
迫不得已!

小弟实在是迫不得已,各位大哥帮忙找找TC的扫雷程序吧!小弟万分感谢!

搜索更多相关主题的帖子: 迫不得已 
2005-12-27 20:38
编写蓝图
Rank: 1
等 级:新手上路
帖 子:59
专家分:0
注 册:2005-11-28
收藏
得分:0 

!网上都找不到吗?


2005-12-28 13:42
编写蓝图
Rank: 1
等 级:新手上路
帖 子:59
专家分:0
注 册:2005-11-28
收藏
得分:0 
你试试能不能运行吧!~!~!~
#include<stdio.h>
#include<graphics.h>
#include<stdlib.h>
struct list
{
int x;
int y;
int num;
int bomb;
int wa;
};
struct list di[10][10];
int currentx=210;
int currenty=130;
void initxy(void)
{
int i,j;
for(i=0;i<=9;i++)
for(j=0;j<=9;j++)
{
di[j].x=i*20+200;
di[j].y=j*20+120;
di[j].wa=0;
di[j].bomb=0;
}
}




void initmu(void)
{
int i,j;
setcolor(2);
rectangle(200,120,400,320);
rectangle(190,110,410,330);
setfillstyle(8,14);
floodfill(191,111,2);
for(i=0;i<=9;i++)
for(j=0;j<=9;j++)
rectangle(di[j].x,di[j].y,di[j].x+19,di[j].y+19);
outtextxy(450,200,"press 'enter' to kick");
outtextxy(450,250,"press '\\' to mark");
}

void randbomb(void)
{
int k;
int i,j;
randomize();
for(i=0;i<=9;i++)
for(j=0;j<=9;j++)
{
k=random(5);
if(k==2)
di[j].bomb=1;

}
}

void jisuan(void)
{
int k=0;
int i,j;
for(i=0;i<=9;i++)
for(j=0;j<=9;j++)
{
if(i&&j&&di[i-1][j-1].bomb)
k=k+1;
if(i&&di[i-1][j].bomb)
k=k+1;
if(j&&di[j-1].bomb)
k=k+1;
if(i<=8&&di[i+1][j].bomb)
k=k+1;
if(j<=8&&di[j+1].bomb)
k=k+1;
if(i<=8&&j<=8&&di[i+1][j+1].bomb)
k=k+1;
if(i&&j<=8&&di[i-1][j+1].bomb)
k=k+1;
if(i<=8&&j&&di[i+1][j-1].bomb)
k=k+1;
di[j].num=k;
k=0;
}
}


void xianbomb(void)
{
int i,j;
char biaoji[2];
char znum[2];
biaoji[0]=1;
biaoji[1]=NULL;
for(i=0;i<=9;i++)
for(j=0;j<=9;j++)
{
if(di[j].bomb==1)
outtextxy(di[j].x+2,di[j].y+2,biaoji);
else
{
itoa(di[j].num,znum,10);
setfillstyle(1,0);
bar(i*20+202,j*20+122,i*20+218,j*20+138);
outtextxy(i*20+202,j*20+122,znum);
}
}
}
void move(void)
{
int key;
key=bioskey(1);
if(key)
key=bioskey(0);

if(key==0x4800)
{
if(currenty>130)
{
setcolor(0);
circle(currentx,currenty,5);
currenty-=20;
setcolor(4);
circle(currentx,currenty,5);
}
else
{
setcolor(0);
circle(currentx,currenty,5);
currenty=310;
setcolor(4);
circle(currentx,currenty,5);
}
}
if(key==0x4b00)
{
if(currentx>210)
{
setcolor(0);
circle(currentx,currenty,5);
currentx-=20;
setcolor(4);
circle(currentx,currenty,5);
}
else
{
setcolor(0);
circle(currentx,currenty,5);
currentx=390;
setcolor(4);
circle(currentx,currenty,5);
}
}
if(key==0x4d00)
{
if(currentx<390)
{
setcolor(0);
circle(currentx,currenty,5);
currentx+=20;
setcolor(4);
circle(currentx,currenty,5);
}
else
{
setcolor(0);
circle(currentx,currenty,5);
currentx=210;
setcolor(4);
circle(currentx,currenty,5);
}
}
if(key==0x5000)
{
if(currenty<310)
{
setcolor(0);
circle(currentx,currenty,5);
currenty+=20;
setcolor(4);
circle(currentx,currenty,5);
}
else
{
setcolor(0);
circle(currentx,currenty,5);
currenty=130;
setcolor(4);
circle(currentx,currenty,5);
}
}
if(key==0x1c0d)
{
int i,j;
char snum[2];
snum[0]=NULL;
snum[1]=NULL;
i=(currentx-210)/20;
j=(currenty-130)/20;
if(di[j].bomb==1)
{
outtextxy(100,100,"game over");
xianbomb();
sleep(2);
exit(0);
}
if(di[j].bomb==0)
{
di[j].wa=1;
setfillstyle(1,0);
bar(currentx-8,currenty-8,currentx+8,currenty+8);
setcolor(15);
itoa(di[j].num,snum,10);
outtextxy(currentx-8,currenty-8,snum);
setcolor(4);
circle(currentx,currenty,5);
}
}
if(key==0x2b5c)
{
char biaoji[2];
biaoji[0]=1;
biaoji[1]=NULL;
setcolor(0);
bar(currentx-8,currenty-8,currentx+8,currenty+8);
setcolor(4);
outtextxy(currentx-8,currenty-8,biaoji);
circle(currentx,currenty,5);
}
}

void success(void)
{
int k=1;
int i,j;
for(i=0;i<=9;i++)
for(j=0;j<=9;j++)
if(di[j].bomb==0&&di[j].wa==0)
k=0;
if(k==1)
{
outtextxy(100,100,"success good");
xianbomb();
sleep(2);
exit(0);

}
}

void main(void)
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"");
initxy();
initmu();
randbomb();
jisuan();
setcolor(4);
circle(210,130,5);
while(1)
{
move();
success();
}
}

2005-12-28 14:10
tinysky5
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2006-3-17
收藏
得分:0 

有错!!

2006-03-17 23:47
haishanglang
Rank: 1
等 级:新手上路
帖 子:378
专家分:0
注 册:2006-3-2
收藏
得分:0 
恩,好象不能运行哟,这么长看也看不懂

2006-03-18 00:02
快速回复:迫不得已!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016987 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved