怎么输出浮点数
查看原帖
怎么输出浮点数
1059622
_win楼主2023/11/22 23:24

用了强制类型转换,还是并不能

#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	double a,b,c,p,ans;
	cin>>a>>b>>c;
	p=(a+b+c)/2;
	ans=sqrt(p*(p-a)*(p-b)*(p-c));
	cout<<(double)ans;
	return 0;
}
2023/11/22 23:24
加载中...