马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{
double a, b, c, area, cosA, cosB, cosC, pi = 3.14159;
cin>>a>>b>>c;
if(a + b > c && a + c > b && b + c > a)
{
cosA = (b * b + c * c - a * a) / (2 * b * c);
area = b * c * sqrt(1 - cosA * cosA) / 2;
cout<<"area = "<<setiosflags(::fixed)<<setprecision(4)<<area<<endl;
}
else cout<<"这三条边不能构成三角形。"<<endl;
return 0;
}
//C:\Users\Administrator\Desktop\c++\Cpp2.cpp(14) : error C2039: 'fixed' : is not a member of '`global namespace''
C:\Users\Administrator\Desktop\c++\Cpp2.cpp(14) : error C2664: 'setiosflags' : cannot convert parameter 1 from 'class std::ios_base &(__cdecl *)(class std::ios_base &)' to 'int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
执行 cl.exe 时出错.
|