Hi there,
Please allow me to clarify a few things about value-return functions.
Although functions are declared as such:
double mostPowerful(double pwrOutput, int jetPacks);
Which means "hey compiler, I'll be using a function called mostPowerful, it takes a double and an int as arguments and it will return a double.". That's declaration, actually executing (or calling) the function, is done as such:
mostPowerful(pwrOutput, jetPacks);
Also, since they return a value, you'll probably want to store that returned value in a variable:
double result = mostPowerful(pwrOutput, jetPacks);
Note that "result" has the same type (double) as the value returned by mostPowerful().
As for your function itself, your declaration states it will return a double. However, your funciton returns:
return pwrOutput, jetPacks;
I don't see your function doing any calculations for it to return, so perhaps a value return function might not be the best suited for this. A simple example would be:
1 2 3 4 5 6 7 8 9
|
int sum(int a, int b)
{
return a+b;
}
int main()
{
std::cout << "3 + 4 = " << sum(3,4);
}
|
As a final remark, on line 29 you try to call your function using pwrOutput and jetPacks as arguments - but they don't exist in main(). Either declare those in main as well, or pass in actual data.
For more information:
http://www.cplusplus.com/doc/tutorial/functions/
http://www.cplusplus.com/doc/tutorial/functions2/
Hope that helps, please do let us know if you have any further questions.
All the best,
NwN