Hello,
You declared the function as: void EnterMoney(arguments);
"void" means: this function will not return anything.
As a result, your compiler should complain at line 100, because there you try to return an integer, which is not nothing.
Try declaring the function as:
int EnterMoney(arguments) both in line 79 and line 3.
Note that in this case, the int Dinero arguments becomes useless, you could just declare the Dinero variable inside the function and initialize it to 0 for any situation.
Another way would be to call the function with the Dinero variable "by reference" instead of "by value". Have a lood at these:
https://www.tutorialspoint.com/cplusplus/cpp_function_call_by_value.htm
https://www.tutorialspoint.com/cplusplus/cpp_function_call_by_reference.htm
If you send the variable from the main function by reference, any change that is made inside the function will immediately update the variable in the main function, so you would not need to return the Dinero variable anymore.
---------------
As for the function arguments, it seems you never use ", int Nickel, int Dime, int Quarter, int Dollar", so I would remove those. The function declaration would then become:
void EnterMoney (int &Dinero, int Price); or
int EnterMoney (int Price);
You provide Price as a pointer, you could just do the same as with the other variables. If you want to change the price, you should calculate the price before you call the function. For example, for a Pepsi you would call it like:
1 2
|
int receivedCash = 0;
EnterMoney (receivedCash, 55);
|
or
int receivedCash = EnterMoney (55);