jordantk
June 7th, 2008, 12:09 PM
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
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