该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
水平有限,凑合吧...
#include
#include
#include
int main()
{
printf("初始分数为0分。赢了加一分,输了减一分,到达6分胜利。到达-6分失败。\n");
int score=0;
do
{
if(score==6)
{
int x=0;
for(x=0;x<10;x++)
printf("YoU WrE tHe WiNnEr!! CoNgRaTuLaTiOnS!!!\n");
fflush(stdin);
getchar();
return 0;
}
if(score==-6)
{
int x=0;
for(x=0;x<10;x++)
printf("YoU lOsT! LoSeR, SuCkEr.\n");
fflush(stdin);
getchar();
return 0;
}
int in;
srand((unsigned)time(NULL));
in=rand()%3;
printf("请选择: 1为剪刀,2为石头,3为布\n");
int choice;
scanf("%d",&choice);
switch(in)
{
case 0:
printf("电脑的选择是剪刀。\n");
if(choice==1)
{
printf("平手,请继续。\n");
}
if(choice==2)
{
printf("你赢了,请继续。\n");
score++;
}
if(choice==3)
{
printf("你输了,请继续。\n");
score--;
}
printf("你现在的分数为:%d.\n",score);
break;
case 1:
printf("电脑的选择是石头。\n");
if(choice==1)
{
printf("你输了,请继续。\n");
score--;
}
if(choice==2)
{
printf("平手,请继续。\n");
}
if(choice==3)
{
printf("你赢了,请继续。\n");
score++;
}
printf("你现在的分数为:%d.\n",score);
break;
case 2:
printf("电脑的选择是布。\n");
if(choice==1)
{
printf("你赢了,请继续。\n");
score++;
}
if(choice==2)
{
printf("你输了,请继续。\n");
score--;
}
if(choice==3)
{
printf("平手,请继续。\n");
}
printf("你现在的分数为:%d.\n",score);
break;
default:
printf("something's wrong.maybe you entered some number other than 1,2,or 3.\n");
}
}while(1);
return 0;
}