#includestdio.h
雨花臺(tái)ssl適用于網(wǎng)站、小程序/APP、API接口等需要進(jìn)行數(shù)據(jù)傳輸應(yīng)用場(chǎng)景,ssl證書(shū)未來(lái)市場(chǎng)廣闊!成為創(chuàng)新互聯(lián)公司的ssl證書(shū)銷(xiāo)售渠道,可以享受市場(chǎng)價(jià)格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:18980820575(備注:SSL證書(shū)合作)期待與您的合作!
#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)); //有改動(dòng)?
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) //有改動(dòng)
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;
}
你對(duì)r賦值的時(shí)候用了兩個(gè)等于號(hào)“==”,賦值用一個(gè)等于號(hào),判斷 的時(shí)候采用兩個(gè)!
而且輸出語(yǔ)句應(yīng)該放在第一個(gè)if外面,應(yīng)該就這兩個(gè)問(wèn)題,代碼如下:
#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;
}