int main()
{
//Declare Variables
double amount = 22.66;
int num;
int dollars;
int quarters;
int dimes;
int nickels;
int pennies;
double x = 22.25;
double y = 55.55;
//Input
cout << "Please enter your dollar amount: ";
cin >> amount;
// Define a function
double foo(double llama) // NOTICE: NO SEMI-COLON HERE
{
return 2.0 * llama;
}
// Call a function, from main
int main()
{
double ama = 21.0;
ama = foo(ama); // call the function.
}
Notice the lack of semi-colons during the definition of the foo function itself (no semi-colon after the set of parentheses).
Can you provide an example? I believe I moved the function definitions
Here is the structure of your main function:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
int main()
{
// some variables
// input
definition of function showMenu definition of function MoneyExchange definition of function max
system("Pause"); //pause the screen
return 0;
}
See those function definitions INSIDE main? That's bad. Don't do that.
Why would they be any different from the ones you've already written? No-one's telling you your function definitions are wrong. We're just telling you that you shouldn't put them inside your main() function.