急求一个可被调用的C语言猜拳程序,不需要复杂功能,只要能进去,游戏,退出,就好
2015-05-19 · 百度知道合伙人官方认证企业
关注
展开全部
#include<stdio.h>
#include<math.h>
main()
{char c1;
int i,j;
do{
printf("Please input :");
scanf("%d",&i);
if(i<1||i>3){printf("Input error!\nPlease input again!\n");continue;}
j=rand()%3+1;
printf("%d\n",j);
if(i==j)printf("Ping Ju!\n");else
if((i-j)==1)printf("YOU WIN!\n");else
if(i==1&&j==3)printf("YOU WIN!\n");else
printf("YOU LOSE!\n");
printf("Replay?(Y/N)");
scanf("%c",&c1);
if(c1=='n'||c1=='N')break;
}while(c1=='y'||c1=='Y');
printf("Welcome to play again!\nAny key Quit...");
getch();putchar('\n');
}
#include<math.h>
main()
{char c1;
int i,j;
do{
printf("Please input :");
scanf("%d",&i);
if(i<1||i>3){printf("Input error!\nPlease input again!\n");continue;}
j=rand()%3+1;
printf("%d\n",j);
if(i==j)printf("Ping Ju!\n");else
if((i-j)==1)printf("YOU WIN!\n");else
if(i==1&&j==3)printf("YOU WIN!\n");else
printf("YOU LOSE!\n");
printf("Replay?(Y/N)");
scanf("%c",&c1);
if(c1=='n'||c1=='N')break;
}while(c1=='y'||c1=='Y');
printf("Welcome to play again!\nAny key Quit...");
getch();putchar('\n');
}
更多追问追答
追问
有问题啊
追答
报的错时什么?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询