三角形边长求高的c语言函数公式,c 求,已知三角形三边边长为abc,利用公式求面积...
優(yōu)質(zhì)回答 回答者:桃桃媽媽
#include
#include
using namespace std;
void main()
{
float a;
float b;
float c;
cout<
cin>>a;
cout<
cin>>b;
cout<
cin>>c;
float area;
float s;
s=(a+b+c)/2;
area=sqrt(s*(s-a)*(s-b)*(s-c)); // sqrt函數(shù)是根號(hào)的意思
cout<
cout<
}
-----------------------------------------------------------------
回答者:突然發(fā)癲
兩個(gè)都正確,一個(gè)是C風(fēng)格,一個(gè)是C++風(fēng)格,都可以運(yùn)行通過(guò)
-----------------------------------------------------------------
回答者:愛(ài)吃桃的胖子
#include
main()
{
float a,b,c,s,area;
scanf(“%f,%f,%f”,&a,&b,&c);
s=1.0/2*(a+b+c);
area=sqrt(s*(s-a)*(s-b)*(s-c));
printf(“a=%7.2f,b=%7.2f,c=%7.2f,s=%7.2f\n”,a,b,c,s);
printf(“area=%7.2f\n”,area);
}
TAGS:
總結(jié)
以上是生活随笔為你收集整理的三角形边长求高的c语言函数公式,c 求,已知三角形三边边长为abc,利用公式求面积...的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 雅虎十四条性能优化原则
- 下一篇: 【Matlab】结构在傅里叶展开下的周期