I need to break down the program into function calls and prompts the user for an order until he exits the program

Pages: 12
You should look at the compiler errors. Half your functions have no return types. Also, saying it's not working and you have only a few minutes to finish won't guarantee help. You need to be specific on what is wrong.

You also have a bunch of stuff just sitting in the global scope
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
if (ColdSandwichesWithChips == 1)
{
ColdSand = Turkey;
}
else if (ColdSandwichesWithChips == 2)
{
ColdSand = RoastBeef;
}
else if (ColdSandwichesWithChips == 3)
{
ColdSand = HamAndCheese;
}
else if (ColdSandwichesWithChips == 4)
{
ColdSand = Tuna;
}
else
{
ColdSand = DeluxeMix;
}


// Allows the user to select a cold sandwich
{
cout << "Select a sandwich by its number from Chuckie's Kitchen Cold Sandwiches: ";
cin >> ColdSandwichesWithChips;
return ColdSandwichesWithChips;
}


One more thing did you even read abstraction's post?
PLEASE USE CODE TAGS (the <> formatting button) when posting code.
http://v2.cplusplus.com/articles/jEywvCM9/
Last edited on
Your function prototypes, calls and definitions still don't match up with each other.

For example -
Your prototype says that you will send an integer parameter and return an integer from this function.
int ColdSands (int);

You're calling the function without a parameter (which I think is OK, but it doesn't match what you told the compiler before). You also don't use the return type when you're actually calling the function.
ColdSandwichesWithChips = int ColdSands();

edit: see Giblit's post above too
Last edited on
wildblue wrote:
You're calling the function without a parameter (which I think is OK, but it doesn't match what you told the compiler before).

No, that's not okay. Compilers will generally allow the call to an undeclared function because the compiler will infer a function signature based on the call. However, you will get an error at link time because no function exists which matches the undeclared function signature.
Sorry - I guess I wasn't clear. Yes, I agree the compiler would complain about mismatching function prototypes, definitions and actual use.

What I meant was that in terms of the actual use of the function - it did not need to receive an argument from main. The function displayed a menu and returned a choice.

Topic archived. No new replies allowed.
Pages: 12