不是,他是有值的,有值就可以直接输出.
顺便问一下我这个程序错在了哪里?为什么输不出结果呢?
#include <stdio.h>
#include <stdlib.h>
#include<math.h>
int main()
{
float a, b, c, s, area;
printf("请输入三角形的三个边长的数值:");
scanf("%f %f %f ", &a, &b, &c);
s = (a + b + c)/2;
area = sqrt(s*(s-a)*(s-b)*(s-c));
printf("三角形的面积为%f",area);
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include<math.h>
int main()
{
float a, b, c, s, area;
printf("请输入三角形的三个边长的数值:");
scanf("%f%f%f", &a,&b,&c);//注意输入格式就可以了,程序没有错
s = (a + b + c)/2;
area = sqrt(s*(s-a)*(s-b)*(s-c));
printf("三角形的面积为%f",area);
return 0;
}
谢谢了,果然成功了,顺便问一下程序可以这样写吗?我在编译时出现了错误,它的只要怎样输出呢?
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a, b, x, y;
scanf("%d%d%d%d", &a,&b,&x,&y);
printf("%d", a=b||x==y);
printf("%d",(a=b)||(x==y));
return 0;
}
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a, b, x, y;
scanf("%d%d%d%d", &a,&b,&x,&y);
printf("%d", a=b||x==y);
printf("%d",(a=b)||(x==y));
return 0;
}
注意输入法问题
[此贴子已经被作者于2006-10-27 20:14:42编辑过]
不一样a=b||x==y相当于
a=(b || (x==y))
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a, b, x, y;
scanf("%d%d%d%d", &a,&b,&x,&y);
printf("%d", a=b||x==y);
printf("%d",(a=b)||(x==y));
return 0;
}
注意输入法问题
请问各位运行的结果是多少呀?