c++ basic help,confused!

This is part of my homework and im so confused. inputAmount and IsValidAmount are 2 other value returning functions. I have to initialize amount and is valid to them? (this is all inside the GetAmount function). This means calling them? PLEASE HELP
--------------------------------------…
GetAmount():

Declare local variables
amount: floating point
isValid: bool

Initialize amount to InputAmount()
Initialize isValid to IsValidAmount()

Loop while isValid is false
Print error message
Update amount to InputAmount()
Update isValid to IsValidAmount()

Return amount
--------------------------------------…
I don't understand how I can initialize a variable to a function?
Try the = operator?
When I try it says function may not be initialized.
Show me the line.
Finally figured it out, not sure if i was doing it backwards or what but i got

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

Also, do you know how I would update them?
OP, just in case randomsites comes back to delete it.

This is part of my homework and im so confused. inputAmount and IsValidAmount are 2 other value returning functions. I have to initialize amount and is valid to them? (this is all inside the GetAmount function). This means calling them? PLEASE HELP
--------------------------------------…
GetAmount():

Declare local variables
amount: floating point
isValid: bool

Initialize amount to InputAmount()
Initialize isValid to IsValidAmount()

Loop while isValid is false
Print error message
Update amount to InputAmount()
Update isValid to IsValidAmount()

Return amount
--------------------------------------…
I don't understand how I can initialize a variable to a function?

If you need to update them you can just use those same lines again.
Topic archived. No new replies allowed.