#include "stdio.h"
#include "stdlib.h"文章源自玩技e族-https://www.playezu.com/240230.html
#include "time.h"文章源自玩技e族-https://www.playezu.com/240230.html
int main文章源自玩技e族-https://www.playezu.com/240230.html
int num,input;文章源自玩技e族-https://www.playezu.com/240230.html
char ch;文章源自玩技e族-https://www.playezu.com/240230.html
char a[4][10]={"棒","老虎","鸡","虫"};文章源自玩技e族-https://www.playezu.com/240230.html
srand(time(NULL));文章源自玩技e族-https://www.playezu.com/240230.html
while(1)文章源自玩技e族-https://www.playezu.com/240230.html
num=rand%4+1;文章源自玩技e族-https://www.playezu.com/240230.html
printf("你出:(1.棒 2.老虎 3.鸡 4.虫)");文章源自玩技e族-https://www.playezu.com/240230.html
scanf("%d",input);
fflush(stdin);
if(input+1==num || (input==4 num==1))
printf("电脑出:%sn",a[num-1]);
printf("你出:%sn",a[input-1]);
printf("你赢了!n");
else if(num+1==input || (num==4 input==1) )
printf("电脑出:%sn",a[num-1]);
printf("你出:%sn",a[input-1]);
printf("你输了!n");
else
printf("电脑出:%sn",a[num-1]);
printf("你出:%sn",a[input-1]);
printf("平局!n");
printf("还想再来一次吗?(Y/N)");
scanf("%c",ch);
fflush(stdin);
if(ch=='Y' ||ch=='y')
continue;
else
break;
中国百科