我又编写了一个C语言程序 但运行后 程序提示 主函数中有2个问题 请大家指点下 谢谢啦!
#include<stdio.h>intmyss(intz,inty);intmain(){intsa;intmh;intsd;intna;printf("imprufe...
#include<stdio.h>
int myss(int z,int y);
int main()
{
int sa;
int mh;
int sd;
int na;
printf("imprufe sa=");
scanf("%d",&sa);
printf("impruf mh=");
scanf("%d",&mh);
printf("impruf sd=");
scanf("%d",&sd);
printf("impruf na=");
scanf("%d",&na);
printf("the first answer is %d",myss(sa,mh));
printf("the second answer is %d",myss(sd,na));
if(myss(sa,mh)<myss(sd,na))
{
printf("the first one is larger than second one!");
}
if(myss(sa.mh)>myss(sd,na))
{
printf("the second one is larger than first one!");
}
if(myss(sa,mh)==myss(sd,na))
{
printf("they are the same!");
}
system("pause");
return 0;
}
int myss(int z,int y)
{
int result=z*y;
return result;
}
当有4个输入变量的时候 我该怎样解决?
另一个就是if语句好像也有问题。
其他问题暂时还没有暴露出来 请大家批评指正。 展开
int myss(int z,int y);
int main()
{
int sa;
int mh;
int sd;
int na;
printf("imprufe sa=");
scanf("%d",&sa);
printf("impruf mh=");
scanf("%d",&mh);
printf("impruf sd=");
scanf("%d",&sd);
printf("impruf na=");
scanf("%d",&na);
printf("the first answer is %d",myss(sa,mh));
printf("the second answer is %d",myss(sd,na));
if(myss(sa,mh)<myss(sd,na))
{
printf("the first one is larger than second one!");
}
if(myss(sa.mh)>myss(sd,na))
{
printf("the second one is larger than first one!");
}
if(myss(sa,mh)==myss(sd,na))
{
printf("they are the same!");
}
system("pause");
return 0;
}
int myss(int z,int y)
{
int result=z*y;
return result;
}
当有4个输入变量的时候 我该怎样解决?
另一个就是if语句好像也有问题。
其他问题暂时还没有暴露出来 请大家批评指正。 展开
2个回答
展开全部
#include<stdio.h>
#include<stdlib.h>
int myss(int z,int y);
int main()
{
int sa;
int mh;
int sd;
int na;
printf("imprufe sa=");
scanf("%d",&sa);
printf("impruf mh=");
scanf("%d",&mh);
printf("impruf sd=");
scanf("%d",&sd);
printf("impruf na=");
scanf("%d",&na);
printf("the first answer is %d",myss(sa,mh));
printf("the second answer is %d",myss(sd,na));
if(myss(sa,mh)>myss(sd,na))
{
printf("the first one is larger than second one!");
}
if(myss(sa,mh)<myss(sd,na))
{
printf("the second one is larger than first one!");
}
if(myss(sa,mh)==myss(sd,na))
{
printf("they are the same!");
}
system("pause");
return 0;
}
int myss(int z,int y)
{
int result=z*y;
return result;
}
你看看我改的吧,其中,倒数第二个if语句中是逗号,你写成了句号。
还有头文件中加了#include<stdlib.h>,因为你加了system("pause")头文件必须要加。
还有你判断第一个大还是第二个大时,大于号和小于号写反了。
#include<stdlib.h>
int myss(int z,int y);
int main()
{
int sa;
int mh;
int sd;
int na;
printf("imprufe sa=");
scanf("%d",&sa);
printf("impruf mh=");
scanf("%d",&mh);
printf("impruf sd=");
scanf("%d",&sd);
printf("impruf na=");
scanf("%d",&na);
printf("the first answer is %d",myss(sa,mh));
printf("the second answer is %d",myss(sd,na));
if(myss(sa,mh)>myss(sd,na))
{
printf("the first one is larger than second one!");
}
if(myss(sa,mh)<myss(sd,na))
{
printf("the second one is larger than first one!");
}
if(myss(sa,mh)==myss(sd,na))
{
printf("they are the same!");
}
system("pause");
return 0;
}
int myss(int z,int y)
{
int result=z*y;
return result;
}
你看看我改的吧,其中,倒数第二个if语句中是逗号,你写成了句号。
还有头文件中加了#include<stdlib.h>,因为你加了system("pause")头文件必须要加。
还有你判断第一个大还是第二个大时,大于号和小于号写反了。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询