#include <stdio.h>
#include <string.h>
#include <conio.h>
#define MAX 17
#define TAX_RATE 0.12
#define LENGTH 30
struct menuItemType
{
char menuItem[LENGTH];
float menuPrice;
int numOrdered;
}theMenu[MAX];
void Menu(void);
int getData(int);
void overView(void);
void initialize(void);
int order(void);
float pbill=0;
float bill=0;
float totalTax=0;
int main(void)
{
int choice=0;
char end;
initialize();
do
{
Menu();
choice = getData(int);
bill += theMenu[choice].menuPrice;
theMenu[choice].numOrdered = order();
printf("%d \t\t\t %s",theMenu[choice].numOrdered ,theMenu[choice].menuItem[LENGTH]);
totalTax = bill * TAX_RATE;
pbill = bill - totalTax;
do{
printf("Would you like to place another order? (Y/N)");
scanf("%c",&end);
}while (end != 'Y' || end != 'y' || end != 'N' || end != 'n');
}while (end == 'Y' || end == 'y');
overView();
printf("\n\n\t\tVATABLE Sales : %f\n",pbill);
printf("\t\t VAT Amount : %f\n\n",totalTax);
printf("\t\t Amount Due : %f",bill);
}
/* shows the Menu */
void Menu(void)
{
clrscr();
int y;
for(y=0;y<=MAX;y++)
{
strcpy(theMenu[y].menuItem[LENGTH],{ " [1] Chicken A",
" [2] Chicken B",
" [3] Chicken C",
" [4] Chicken D",
" [5] Chicken E",
" [6] Chicken F",
" [7] Pork A",
" [9] Pork C",
"[10] Pork D",
"[11] Pork E",
"[12] Pork F",
"[13] Beef A",
"[14] Beef B",
"[15] Beef C",
"[16] Beef D",
"[17] Beef E",
"[18] Beef F"});
}
for(y=0;y<=MAX;y++)
{
theMenu[y].menuPrice = {70.00,
71.00,
72.00,
74.00,
75.00,
70.00,
80.00,
80.00,
82.00,
90.00,
91.00,
93.00,
97.00,
96.00,
99.00,
100.00,
120.00,
110.00};
}
for(y=0;y<=MAX;y++)
{
printf("\t%s \t\t%f",theMenu[y].menuItem[LENGTH], theMenu[y].menuPrice);
printf("\n");
}
}
/* Initialize */
void initialize(void){
int x=0;
for (x = 0; x <= MAX; x++)
{
theMenu[x].numOrdered = 0;
}
}
/* getData */
int getData(int z)
{
z=0;
printf("\nPlease choose a food item by the corresponding number.");
scanf("%d",&z);
z -= 1;
return z;
}
/* overView */
void overView(void)
{
clrscr();
int y=0;
printf("\t\tWelcome to Porky's Meat Shop");
for (y = 0; y <= MAX; y++)
{
if (theMenu[y].numOrdered > 0)
{
printf("\n\n %d \t %s \t %f\n",theMenu[y].numOrdered, theMenu[y].menuItem[LENGTH], theMenu[y].menuPrice);
printf("\n");
}
}
}
/* ORDER */
int order(void)
{
int g;
printf("\n\n\n\t\t\tHow many orders? ");
scanf("%d",&g);
return g;
}
Error: Expression syntax in function main on the last 2 errors and "too few parameters in call to "getData" in function main".
choice = getData(int);
strcpy(theMenu[y].menuItem[LENGTH],{ " [1] Chicken A",
theMenu[y].menuPrice = {70.00,
pls tell me where did i go wrong? this is not yet a finished project.. i'm trying to run this first before putting the main menu...
you can tell that the variables on the structure are familiar. i just copied someone's code.. only in the structure..