c语言高手这为什么不能运行??
解决时间 2021-07-31 06:22
- 提问者网友:夢醒日落
- 2021-07-31 02:46
#include<math.h>
main()
{
int tall,weight,normal,fat,thin;
printf("please input tall and weight:");
scanf("%f%f",&tall,&weight);
normal==tall-110;
if(normal-5<=weight<=normal+5)
printf("%s\n","normal");
else if(weight>normal+5)
printf("%s\n","fat");
else if(weight<normal-5)
printf("%s\n","thin");
}
最佳答案
- 五星知识达人网友:梦中风几里
- 2021-07-31 03:34
这是修改后的,在DEV-C++通过检测
main()
{
int tall,weight,normal,fat,thin;
printf("please input tall and weight:");
scanf("%d,%d",&tall,&weight);
normal=tall-110;
if(normal-5<=weight&&weight<=normal+5)
printf("%s\n","normal");
else if(weight>normal+5)
printf("%s\n","fat");
else if(weight<normal-5)
printf("%s\n","thin");
}
全部回答
- 1楼网友:刀戟声无边
- 2021-07-31 06:36
#include<stdio.h>////你/这也没有头文件
#include<math.h>
main()
{
int tall,weight,normal;/////这多余
printf("please input tall and weight:");
do{
scanf("%d %d",&tall,&weight);/////这错了,输入数值之间应有分隔符
}while(tall < 110);////这必须tall比110大
normal=tall-110;/////这也错了,多了一个等号
if(normal-5<=weight && weight<=normal+5)
printf("%s\n","normal");
else if(weight>normal+5)
printf("%s\n","fat");
else if(weight<normal-5)
printf("%s\n","thin");
}
不明白的话 加我870662874嘻嘻
- 2楼网友:患得患失的劫
- 2021-07-31 05:31
normal==tall-110; 多了一个等号
scanf("%f%f",&tall,&weight); 这两个是整形的吧
normal-5<=weight<=normal+5不能这么写
normal-5<=weight&&weight<=normal+5;
- 3楼网友:纵马山川剑自提
- 2021-07-31 04:39
#include <stdio.h>
#include <math.h>
main()
{
int tall,weight,normal,fat,thin;
printf("please input tall and weight:");
scanf("%d%d",&tall,&weight);
normal==tall-110;
if(normal-5<=weight && weight<=normal+5)
printf("%s\n","normal");
else if(weight>normal+5)
printf("%s\n","fat");
else if(weight<normal-5)
printf("%s\n","thin");
}
我要举报
大家都在看
推荐资讯