expected a declaration error with loop?

................
Last edited on
OP:
float getAmount()
float amount;
bool isValid;

float amount = inputAmount();
bool isValid = isValidAmount(amount);


while(!isValid)
{
cout << "Error Message";
amount = inputAmount();
isValid = isValidAmount();
}

return amount;


Missing a semi-colon after float getAmount(), or alternatively missing a { and a } if this intended to be a function definition. In which case, this level of C++ is way beyond you and you should go back to the beginning.

amount and isValid are declared twice.
Last edited on
Topic archived. No new replies allowed.