十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
#includestdio.h
雨花台ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为创新互联公司的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:18980820575(备注:SSL证书合作)期待与您的合作!
#includemath.h
main()
{ float a,b,c;
float s,area;
scanf("%f,%f,%f",a,b,c);
if(a+bcb+caa+cb)
{ s=(a+b+c)/2;
area=sqrt(s*(s-a)*(s-b)*(s-c)); //有改动
printf("the area is:%f\n",area);
if(a==ba==c)
printf("equilateral triangle\n");
else if(a==b||b==c||a==c)
printf("isoceles triangle\n");
else if(fabs(a*a+b*b-c*c)1e-8||fabs(a*a+c*c-b*b)1e-8||fabs(b*b+c*c-a*a)1e-8) //有改动
printf("right angled triangle\n");
else
printf("triangle");
}
else
printf("can not compose triangle");
}
void rectan(){
double a,b,c, square;
double tmp;
char max;
scanf("%lf%lf%lf",a,b,c);
if( a == b || b==c || a ==c){//等腰三角形一定为锐角(包含等边)
printf("锐角三角形\n");
return;
}
//将角C选为最大角,若输入不是此交换使C最大
max = ab?(tmp = a,'a'):(tmp = b,'b');
max = tmpc?max:(tmp = c,'c');
if(max != 'c'){
tmp = a;
a = c;
c = tmp;
}
你对r赋值的时候用了两个等于号“==”,赋值用一个等于号,判断 的时候采用两个!
而且输出语句应该放在第一个if外面,应该就这两个问题,代码如下:
#include stdio.h
int main(){
int a, b, c, r;
printf("Please input three integers:\n");
scanf("%d%d%d",a,b,c);
if(a == b ==c) r = 3;
else{
if(a + b c a - b c){
if(b + c a b - c a){
if(a + c b a - c b){
if(a * a == b * b + c * c || b * b == a * a +c * c || c * c == a * a + b * b)
r = 1;
else if((a == b a != c) || (b == c a != b )|| (a ==c b != a))
r = 2;
else
r = 0;
}
else
r = -1;
}
else
r = -1;
}
else
r =-1;
}
if(r == -1)
printf("Tt's not an integer.");
else if(r == 0)
printf("It's an scalenous triangle.");
else if(r == 1)
printf("It's an right-angeld triangle.");
else if(r == 2)
printf("It's an isosceles triangle.");
else if(r == 3)
printf("It's an equilateral triangle.");
return 0;
}