#include <stdio.h>
int main()
{
char yzfy,wtthappy;
while (scanf("%s%s",yzfy,wtthappy) != EOF)
{
int num=result(yzfy,wtthappy)
if(num=-49||num=-85||num==-1)
{
printf("wtthappy wins!");
continue;
}
else if(num=-5||num=-41||num==-89)
{
printf("wtthappy wins!");
continue;
}
else
printf("The game ends in a draw");
return 0;
}
int result(char y,char w)
{
int num1=0,num2=0;
if(y="stone")
num1=1;
else if(y="scissors")
num1=5;
else
num1=9;
if(w="stone")
num2=10;
else if(w="scissors")
num2=50;
else
num2=90;
return num1-num2;
}
编译不过的简单C程序帮我看看错误吧
答案:2 悬赏:40 手机版
解决时间 2021-05-03 00:42
- 提问者网友:鼻尖触碰
- 2021-05-02 16:41
最佳答案
- 五星知识达人网友:青灯有味
- 2021-05-02 17:29
#include <stdio.h>
#include <string.h>
int result(char* y,char* w);
int main()
{
char yzfy[50],wtthappy[50];
while (scanf("%s%s",yzfy,wtthappy) != EOF)
{
int num=result(yzfy,wtthappy);
if(num==-49||num==-85||num==-1)
{
printf("wtthappy wins!");
continue;
}
else if(num==-5||num==-41||num==-89)
{
printf("wtthappy wins!");
continue;
}
else
printf("The game ends in a draw");
}
return 0;
}
int result(char* y,char* w)
{
int num1=0,num2=0;
if(strcmp(y,"stone") == 0)
num1=1;
else if(strcmp(y,"scissors") == 0)
num1=5;
else
num1=9;
if(strcmp(w,"stone") == 0)
num2=10;
else if(strcmp(w,"stone") == 0)
num2=50;
else
num2=90;
return num1-num2;
}
#include <string.h>
int result(char* y,char* w);
int main()
{
char yzfy[50],wtthappy[50];
while (scanf("%s%s",yzfy,wtthappy) != EOF)
{
int num=result(yzfy,wtthappy);
if(num==-49||num==-85||num==-1)
{
printf("wtthappy wins!");
continue;
}
else if(num==-5||num==-41||num==-89)
{
printf("wtthappy wins!");
continue;
}
else
printf("The game ends in a draw");
}
return 0;
}
int result(char* y,char* w)
{
int num1=0,num2=0;
if(strcmp(y,"stone") == 0)
num1=1;
else if(strcmp(y,"scissors") == 0)
num1=5;
else
num1=9;
if(strcmp(w,"stone") == 0)
num2=10;
else if(strcmp(w,"stone") == 0)
num2=50;
else
num2=90;
return num1-num2;
}
全部回答
- 1楼网友:孤独的牧羊人
- 2021-05-02 17:44
你这个程序错误太多了、、
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯