返回后Cout不起作用

时间:2016-03-06 04:52:49

标签: c++

Cout(以及我在返回后尝试放置的所有其他内容)在此函数返回后放置时不起作用。怎么了?

   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;

}

1 个答案:

答案 0 :(得分:1)

返回会导致您离开该功能的范围。所以&#34;返回后#34;不被感动。