The answer of this function is returned into the main function of the program, and that works fine. The issue is that any value where the cosine should be 0, it turns out to give a weird irrational number (something like 1.30431912*10^-13). So, 90, 450, and so on, all turn out irrational answers. What's the matter?
float cosineDegrees() {
string i;
double iDouble;
cout << "Give me a number to find the value of degrees in. ";
getline(cin, i);
iDouble = stod(i);
double PI = 3.14159265359;
float answer = cos((PI/180)*iDouble);
return answer;
}