セカンダリ関数に格納された値を DEV-C++ のメイン関数に返す単純な関数を作成しようとしていますが、なぜ機能しないのかわかりません:/
正しく実行されているはずですが、プログラムをコンパイルして実行すると、値の入力を求められず、0 と、入力された値が 0 の場合にステートメントに付随する文が表示されます。
// This program asks user to enter IQ score and then displays a message
#include<iostream>
using namespace std;
double getIQ();
int main()
{
double iq = 0.0;
getIQ();
if (iq > 120)
{
cout << "You are a genius" << endl;
}
else
{
cout << "You don't need a high IQ to be a successful person" << endl;
}
system("pause");
return 0;
}
double getIQ()
{
double iq = 0.0;
cout << "Enter IQ score: " << iq << endl;
return iq;
}