Trying to make a simple function to return a value stored in a secondary function to the main function in DEV-C++ and I'm not sure why it's not working :/
I really feel like it should be running correctly but when I compile and run the program it does not ask to enter a value and displays 0 and the sentence that goes with the statement when 0 is the entered value.
// 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;
}