Cout (and everything else I've attempted to put after the return) doesn't work when placed after the return in this function. What's wrong?
float tanDegrees() {
string i;
double iDouble;
string choice;
cout << "Give me a number to find the value of degrees in. ";
getline(cin, i);
iDouble = stod(i);
double PI = 3.14159265359;
float answer = tan((PI / 180)*iDouble);
cout << "Test!" << endl;
return answer;
cout << "Test!" << endl;
}
The return causes you to leave the function's scope. So anything after "return" won't be touched.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.