请检查代码中是否包含:if ( num == hd * hd * hd + td * td * td + sd * sd * sd ) 或者包含:if ( hd * hd * hd + td * td * td + sd * sd * sd == num ),再试试!
这。。。
这。。。
2015-02-07
#include <stdio.h>
int getGirth(int a,int b,int c)
{if( (a+b)<=c || (a+c)<=b || (b+c)<=a ){printf("不构成三角形\n");return 0;}else{int cirf = a+b+c ;return cirf;
}
}
int main()
{int a, b, c;a = 3;b = 4;c = 5;printf("三角形的周长是:%d\n", getGirth(a,b,c));return 0;}
int getGirth(int a,int b,int c)
{if( (a+b)<=c || (a+c)<=b || (b+c)<=a ){printf("不构成三角形\n");return 0;}else{int cirf = a+b+c ;return cirf;
}
}
int main()
{int a, b, c;a = 3;b = 4;c = 5;printf("三角形的周长是:%d\n", getGirth(a,b,c));return 0;}
已采纳回答 / onemoo
你在第一个printf中是用强制类型转换的方式将num转换成int型传入,不过准确的说,在第二个printf中并不存在类型转换。因为printf中%d代表它希望相应的参数类型为int,如果你传入的不是int型,一般来说编译器会给出警告的,通常仍可编译通过,但是在运行时printf函数仍然把那个参数当作int型来读取和打印。一般计算机中int和double的存储方式是不一样的,所以造成打印出很“奇怪”的数。而那个num2,你用了一个double类型的num来初始化,所以编译器会先把num转换成int型来给n...
2015-02-07
已采纳回答 / 火Rain
原则上只要头文件中的“#include”与“<stdio.h>”这俩个你不将其中任何一个拆分或者把俩者换行,俩者间你空多少个空格都是可行的!作者也可以自己在编辑器里面尝试一下,看下是否如此!
2015-02-07