|
-
June 7th, 2008, 12:09 PM
#1
"return" error on function
Hi everyone,
I get the following error when I try to build my console program:
"error C2059: syntax error : 'return'"
#include <iostream>
#include <string>
using namespace std;
// Function Prototypes
double getValidValue(string question, double max, double min);
int main()
{
double loan = 0;
loan = getValidValue("Enter a loan amount", 10000000, 100);
}
double getValidValue(string question, double max, double min)
{
bool goodAnswer = false;
double answer = 0.0;
while(!goodAnswer);
do
{
cout << question << " (" << max << " <-> " << min << ") : ";
cin >> answer;
if (answer <= max && answer >= min)
{
goodAnswer = true;
}
}
return answer;
}
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|