掷筛子c语言小程序,求助,做了个掷骰子的小程序,卡在第一个界面上怎么点都没反应...

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

#include

#include

#include

#include

#include

#includevoid zhuye()

{

IMAGE back,button; loadimage(&back, L"picture\\背景.jpg",800,600);

loadimage(&button, L"picture\\开始.jpg",100,50);

putimage(0, 0, &back);

putimage(300, 520, &button); settextcolor(WHITE);

RECT x = { 0, 0, 639, 420 };

drawtext(_T("骰子游戏"), &x, DT_CENTER | DT_VCENTER | DT_SINGLELINE);

RECT r = { 0, 0, 639, 479 };

drawtext(_T("用户与电脑轮流掷6次,每次掷的点数累加,"), &r, DT_CENTER | DT_VCENTER | DT_SINGLELINE);

RECT d = { 0, 0, 639, 550 };

drawtext(_T("用每次掷的点数累加,最终点数最大的胜出."), &d, DT_CENTER | DT_VCENTER | DT_SINGLELINE);

RECT q = { 0, 0, 639, 600 };

drawtext(_T("请点击开始游戏来游玩游戏"), &q, DT_CENTER | DT_VCENTER | DT_SINGLELINE);

}int Menu()

{

zhuye();

int shu=0;

MOUSEMSG msg;

do {

msg = GetMouseMsg();

if (msg.uMsg=WM_LBUTTONDOWN)

{

if((msg.x>0 && msg.x<800) && (msg.y>0 && msg.y<500))

shu = 1;

}

}

while (shu == 0);

return shu;

}void yemian2()

{

IMAGE img;

loadimage(&img,L"picture\\photo.jpg");

putimage(0,0,&img);

}int shubiao()

{

zhuye();

int shu=0;

MOUSEMSG msg;

do {

msg = GetMouseMsg();

if (msg.uMsg=WM_LBUTTONDOWN) {

if((msg.x>0 && msg.x<800) && (msg.y>0 && msg.y<500))

shu = 1;

}

}

while (shu == 0);

return shu;

}

void tupian()

{

TCHAR DIANSHU[6];

yemian2();

IMAGE img[6];

int k;

k=rand()%6+1;

_stprintf(DIANSHU, _T("picture\\%d.jpg"), k);

loadimage(&img[k],DIANSHU, 112, 112);

putimage(300,300, &img[k]);

}

void shuchu()

{

switch(rand()%6+1 )

{

case '1':

tupian();

Sleep(1000);

break;

case '2':

tupian();

Sleep(1000);

break;

case '3':

tupian();

Sleep(1000);

break;

case '4':

tupian();

Sleep(1000);

case'5':

tupian();

Sleep(1000);

case'6':

tupian();

Sleep(1000);

}

}

void zhitouzi( )

{

int i,j,d1,d2;

srand((unsigned)time(NULL));

rand();

d1= d2= 0;

{

for(i=1; i<=6; i++)

j=rand()%6+1;

d1 = d1+j+1;

shuchu(); }

if(d1>d2)

printf("\nYou win.\n");

else

if (d1

printf("\nBOT win.\n");

else

printf("平局\n");

}

void game()

{

switch(shubiao())

case'1':

zhitouzi();}void main()

{

initgraph(800, 600);

switch(Menu())

{

case'1':

yemian2();

game();

break;

}

getch();

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值