大神们,快来帮帮忙 80
3个回答
2015-12-06 · 做真实的自己 用良心做教育
千锋教育
千锋教育专注HTML5大前端、JavaEE、Python、人工智能、UI&UE、云计算、全栈软件测试、大数据、物联网+嵌入式、Unity游戏开发、网络安全、互联网营销、Go语言等培训教育。
向TA提问
关注
展开全部
参考代码如下:
#include <stdio.h>
void main(void)
{
int datain;
int remains=21;
printf("Here are 21 matches,you and me pick one to four of then in turn,now you first!\n");
while(remains)
{
printf("Pls input the number you want to pick(1 to 4): ");
scanf("%d",&datain);
if(datain<1||datain>4)
{
printf("Wrong number,Pls reinput!\n\n");
}
else
{
printf("then computer will get %d.\n"5-remains);
remains-=5;
printf("now remains %d.\n",remains);
if(remains==1)
{
printf("\nNow you have to get the last one,\nso th ecomputer is win !!\n");
remains=0;/*quit the while() loop*/
}
}
}
return;
}
#include <stdio.h>
void main(void)
{
int datain;
int remains=21;
printf("Here are 21 matches,you and me pick one to four of then in turn,now you first!\n");
while(remains)
{
printf("Pls input the number you want to pick(1 to 4): ");
scanf("%d",&datain);
if(datain<1||datain>4)
{
printf("Wrong number,Pls reinput!\n\n");
}
else
{
printf("then computer will get %d.\n"5-remains);
remains-=5;
printf("now remains %d.\n",remains);
if(remains==1)
{
printf("\nNow you have to get the last one,\nso th ecomputer is win !!\n");
remains=0;/*quit the while() loop*/
}
}
}
return;
}
更多追问追答
追问
怎么搞
这个好像不对
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询