回覆列表
  • 1 # 使用者834195712159

    程式碼示例:

    #include <iostream>

    #include <cmath>

    using namespace std;

    int main()

    {

    float a,b,c,C;

    cout <<"Please enter two numbers of triangle as a and b:";

    cin >> a >> b;

    cout <<"Please enter the angle of the triangle as A and B:";

    cin >> C;

    c = sqrt(a*a + b*b - 2*a*b*cos(3.1415926/180*C));

    cout <<"The length of c is:"<< c <<endl;

    return 0;

    }

    cos接受的是弧度,輸入角度乘上pi/180轉換為弧度後呼叫才能得到正確結果

  • 中秋節和大豐收的關聯?
  • 蘋果6p螢幕自動操作,亂跳,各種不聽使喚是怎麼回事?