Re: Overload function error
Quote:
Originally Posted by
TheJollyRoger
I am getting the error of overload and undefined with the lines underneath, but I don't know why.
Code:
void displayMenu(menuOptions menu[], int &size);
void getData(menuOptions menu[], int &size);
void printCheck(menuOptions menu[], int &size);
Code:
//
...
//prototype
void displayMenu(menuOptions menu[], int &size);
void getData(menuOptions menu[], int &size);
void printCheck(menuOptions menu[], int &size);
//constants
const int max = 8;
const double taxes = 1.05;
...
//display menu and tell user what to do
void displaymenu(menuOptions menu[], int size)
{
...
}
You declared
Code:
void displayMenu(menuOptions menu[], int &size);
but implemented
Code:
void displaymenu(menuOptions menu[], int size);
Don't you see the differences?
Re: Overload function error
Code:
void displayMenu(menuOptions menu[], int &size);
void printCheck(menuOptions menu[], int &size);
...
void displaymenu(menuOptions menu[], int size) {}
void printCheck(menuOptions menu[], int size) {}
The forward declaration needs to match the definition. In these cases the declaration for size is by ref and the definition is by value. Also the spelling of the declaration and definiton for displaymenu!
Re: Overload function error
Re: Overload function error
I see it now, I appreciate it, thanks.
Re: Overload function error
When I try to add several of the same item the program only calculates it once, how can I change that?
Re: Overload function error
Quote:
Originally Posted by
TheJollyRoger
When I try to add several of the same item the program only calculates it once, how can I change that?
You have to debug your code to see what, where, and why goes wrong/unexpected!
Re: Overload function error
Some comments on the code posted in post #1
Code:
// Press 9 when you are finished
while (number != -1)
???
Code:
//Select your item 1-8
if (number >= 1 && number <= 8)
Doesn't the size argument stipulate how many items there are on the menu?
Code:
menu[number - 1].quantity = 1;
What about if more than one quantity is wanted?
Re: Overload function error
I have updated the code, and now I am working on how to make the same selection multiply times.
Re: Overload function error
Quote:
Originally Posted by
TheJollyRoger
I have updated the code, and now I am working on how to make the same selection multiply times.
Good! Now see my post#7, learn the debugger! Good luck! :)