[求助]关于逻辑运算符的问题
我想问一下a=b||x==y和(a=b)||(x==y)一样吗?为什么呀?谢谢了!
顺便问一下我这个程序错在了哪里?为什么输不出结果呢?
#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;
}