Code:
#include <stdio.h> // def's 4 printf,scanf,gets,puts,getchar,fflush
#include <conio.h> // def's 4 getch
#include <stdlib.h> // def's 4 system
#define GST 5
#define PST 8
int main()
{
int counter[18]=0;
long total, discount, subtotal, tip, pst, gst, tippercent;
char choice[50]={'\0'};
item[25][35] = {
{"APPLE PIE"},
{"ATLANTIC SALMON"},
{"Banana Sp"},
{"B.L.T. SANDWICH"},
{"CHEDDAR CHEESE BURGER"},
{"CLUB HOUSE SANDWICH"},
{"Coffe"},
{"FILET MIGNON"},
{"GRILLED CHEESE/FRIES"},
{"GRAIN FED VEAL"},
{"HOT BBQ BEEF Sandwich"},
{"Juice "},
{"POP"},
{"ROAST PRIME RIB"},
{"Shakes"},
{"VEGETARIAN CHOW MEIN"}
}
int price[25]={355,1645,499,957,699,1099,199,2199,599,2500,999,249,165,1245,285,895);
subtotal=discount=gst=tip=pst=total=0;
do
{
system ("cls");
printf("\n\t\t\t\tDAVE'S RESTAURANT");
printf("\n\nItem ENTREES\t\t\tPrices\t# Item\tDrinks\t Prices #");
printf("\n--------------------------------------------------------------------------------");
printf("\n A %s \t%.2f\t%i\tK\t%s\t %.2f %i",i1, i1_p, a_counter, i11, i11_p, k_counter);
printf("\n B %s \t%.2f\t%i\tL\t%s\t %.2f %i",i2, i2_p, b_counter, i12, i12_p, l_counter);
printf("\n C %s \t%.2f\t%i\tM\t%s\t %.2f %i",i3, i3_p, c_counter, i13, i13_p, m_counter);
printf("\n D %s \t\t%.2f\t%i",i4, i4_p, d_counter);
printf("\n E %s \t%.2f\t%i",i5, i5_p, e_counter);
printf("\n F %s \t%.2f\t%i\t\tDESSERTS",i6, i6_p, f_counter);
printf("\n G %s \t%.2f\t%i",i7, i7_p, g_counter);
printf("\n H %s \t%.2f\t%i\tN\t%s\t %.2f %i",i8, i8_p, h_counter, i14, i14_p, n_counter);
printf("\n I %s \t%.2f\t%i\tO\t%s %.2f %i",i9, i9_p, i_counter, i15, i15_p, o_counter);
printf("\n J %s \t\t%.2f\t%i\tP\t%s %.2f %i",i10, i10_p, j_counter, i16, i16_p, p_counter);
printf("\n");
printf("\n================================================================================");
printf("\n");
pst = subtotal * PST;
gst = subtotal * GST;
subtotal = ;
total = +gst+pst+tip-discount;
printf("\n\t\t\t\t\t\tSubtotal = %.2f",subtotal);
printf("\n\t\t\t\t\t\tPST = %.2f",pst);
printf("\n\t\tSPECIAL DISCOUNT\t\t\tGST = ",gst);
printf("\n\t\t%.2f\t\t\t\tTIP = ",discount, tip);
printf("\n\t\t\t\t\t\tTOTAL = ",total);
printf("\n================================================================================");
printf("\nSELECT (A-P), R-RESET, - CORRECT, T-TIP, S-DISCOUNT, X-EXIT");
scanf("%c", &choice);
choice = toupper(choice);
i = choice - 'A';
total += price[i];
switch(choice) {
case 'T': printf ("ENTER TIP PERCENTAGE ");
scanf ("%d", &tippercent);
tip = (subtotal*tippercent);
break;
case 'X':
printf ("Press any Key to Exit");
getchar();
break;
default:
printf("INVALID CHOICE!\a\a");
}
}while (1);
return 0;
}
Since the menu lists items in columns, grouped by type, the display would need another