修复给定代码中的语法错误。该规范的目的是根据另两条边的长度以及它们之间的夹角,使用如下所示的余弦定律计算三角形边的长度:
#include
#include
using namespace std;
const float PI = 3.14159f;
float DegreesToRadians(float degrees)
{
degrees * PI / 180.0f;
float CalcTriangleEdge(float a float b float gamma)
return sqrt(a * a + b * b - 2 * a * b * cos gamma);
}
int main()
{
auto a, b, gamma;
cout << "Enter the length side a: ";
cin << a;
cout << "Enter the length of side b: "
cin << b;
cout << "Enter the angle gamma: ";
cin << gmma;
cout << "The length of side c is " << CalcTriangleEdge(a, b, RadiansToDegrees(gamma)) << end;
return "0";
}
我已经修改了一部分,但是还是有很多错误,所以请帮忙,谢谢。我只是一个初学者。