C++ 在c+中使用三角函数时,如何校正nan+; cout>A\u v; cout>B_v; 当我使用三角函数时,我能得到“nan”错误吗?你说的“校正nan”具体是什么意思?你输入弧度或度吗?而且,使用atan(角度)似乎不正确。没有数值作为答

C++ 在c+中使用三角函数时,如何校正nan+; cout>A\u v; cout>B_v; 当我使用三角函数时,我能得到“nan”错误吗?你说的“校正nan”具体是什么意思?你输入弧度或度吗?而且,使用atan(角度)似乎不正确。没有数值作为答,c++,visual-c++,error-handling,nan,trigonometry,C++,Visual C++,Error Handling,Nan,Trigonometry,在c+中使用三角函数时,如何校正nan+; cout>A\u v; cout>B_v; 当我使用三角函数时,我能得到“nan”错误吗?你说的“校正nan”具体是什么意思?你输入弧度或度吗?而且,使用atan(角度)似乎不正确。没有数值作为答案,这就是为什么计算结果是nan。不幸的是,由于所显示的代码无法满足stackoverflow.com对a的要求,因此没有任何其他人能够告诉您。 cout << "Please enter the A vector

在c+中使用三角函数时,如何校正nan+;
cout>A\u v;
cout>B_v;

当我使用三角函数时,我能得到“nan”错误吗?你说的“校正nan”具体是什么意思?你输入弧度或度吗?而且,使用atan(角度)似乎不正确。没有数值作为答案,这就是为什么计算结果是nan。不幸的是,由于所显示的代码无法满足stackoverflow.com对a的要求,因此没有任何其他人能够告诉您。
    cout << "Please enter the A vector's magnitude \n";
    cin >> A_v;
    cout << "Please enter the B vector's magnitude \n";
    cin >> B_v;
    cout << "The general form to find the direction of the resultant vector = \n" << "tan^-1 X " << UL << " [B X sin] \n" << UL_
    << "        [A + B X cos]\n";
    cout << "Please enter the angle value \n";
    cin >> ct;
    cost = cos(ct);
    sint = sin(ct);
    itan = atan(ct);
    al = itan*((B*sint)/(A+(B*cost)));
    ald = al*(180/3.141562);
    cout << "The direction of the vector is inclined at " << ald << " degrees \n";