我正在从一本名为C ++ Modules for Gaming的书中练习第3章(功能)。这是我无法做的一个问题是找到(2,4)的atanf(4/2),根据书和我的计算器应该回馈'63 .42'度。
相反,它给了我1.107度。
这是我的代码:
#include "stdafx.h"
#include <iostream>
#include <cmath>
using namespace std;
void tani(float a,float b) //Finds the Tan inverse
{
float res;
res = atanf(b / a);
cout << res << endl;
}
int main()
{
cout << "Enter The Points X and Y: " << endl;
float x, y;
cin >> x >> y; //Input
tani(x,y); //calling Function
}