#include<iostream>
usingnamespace std;
double get_coin(double c);
int main()
{
double coin ;
coin = get_coin() ;
return 0;
}
double get_coin(double c)
{
double coin ;
cout << "Cost of a fried twinkie is $3.50\n"
<< "--------------------------------\n"
<< "Please enter coin: $";
cin >> coin ;
return coin ;
}
chap4pp15.cpp: In function ‘int main()’:
chap4pp15.cpp:9:25: error: too few arguments to function ‘double get_coin(double)’
coin = get_coin() ;
^
chap4pp15.cpp:4:8: note: declared here
double get_coin(double c);
Don't mean to be a dick or anything but the error is pretty straight forward
chap4pp15.cpp:9:25: error: too few arguments to function ‘double get_coin(double)’
coin = get_coin() ;
Basically, your function prototype has a parameter of a double and you call the function with zero parameters. It should be coin = get_coin(coin);
Also, in your function line 14 is not needed, line 18 should be cin >> c; and I would remove line 19 and pass by reference or change it to return c; currently I see no purpose of having a parameter to pass unless you want to pass it as a reference (&). To do it the way you are currently I would change the prototype and declaration to double get_coin(void); or double get_coin(); and leave the rest of the function how it is.
if I understood what this function does then the function protoype is wrong and should be: double get_coin(); //no parameters
the body remains the same