Logo 
Search:

C Programming Forum

Ask Question   UnAnswered
Home » Forum » C Programming       RSS Feeds

Displaying Restaurant Bill HELP Please !

  Asked By: Suman    Date: Apr 24    Category: C Programming    Views: 3884
  

Hello people.I'm just a beginner at C programming and i have a project. My project is preparing a restaurant bill. I have displayed the food menu and the program takes the order from the customer but now i have a problem. I want to display the list of ordered items along with the total price of each item and the grand total at the end of the program. I have pasted the source code below and this source code only displays the grand total at the end of program. Can anyone please help me in displaying the list of all ordered items?





#include<stdio.h>
#include<conio.h>
#include<ctype.h>
#include<process.h>
void main()
{

int i,j,ch,total=0,t1,r1=80,p1,t2,r2=90,p2,t3,r3=110,p3,t4,r4=180,p4;
menu:
system("cls");
for (i=1;i<=5;i++)
{
for(j=1;j<=30;j++)
{
if(i==3)
{
printf("WELCOME TO BIR GORKHALI KITCHEN");
break;
}
else
{
printf("*");
}
}
printf("\n");
}
printf("S.NO. \t Items \t \t Rate \n");
printf("1. \t MO:MO \t \t 80 \n");
printf("2. \t Chowmin \t 90 \n");
printf("3. \t Burger \t 110 \n");
printf("4. \t Sizzler \t 180 \n");
printf("\n What would you like to have? Enter serial no.");
scanf("%d",&ch);
if (ch==1)
goto momo;
if (ch==2)
goto chow;
if (ch==3)
goto burger;
if (ch==4)
goto sizz;
else
goto bill;

momo:
printf("How many plates would you like to order?");
scanf("%d",&p1);
t1=r1*p1;
total=total+t1;
printf("Would you like to have anything else? Y/N ");
if (toupper(getch())=='Y')
goto menu;
else
goto bill;

chow:
printf("How many plates would you like to order?");
scanf("%d",&p2);
t2=r2*p2;
total=total+t2;
printf("Would you like to have anything else? Y/N ");
if (toupper(getch())=='Y')
goto menu;
else
goto bill;

burger:
printf("How many plates would you like to order?");
scanf("%d",&p3);
t3=r3*p3;
total=total+t3;
printf("Would you like to have anything else? Y/N ");
if (toupper(getch())=='Y')
goto menu;
else
goto bill;

sizz:
printf("How many plates would you like to order?");
scanf("%d",&p4);
t4=r4*p4;
total=total+t4;
printf("Would you like to have anything else? Y/N ");
if (toupper(getch())=='Y')
goto menu;
else
goto bill;

bill:
printf("\n");
for (i=1;i<=3;i++)
{
for(j=1;j<=30;j++)
{
if(i==2)
{
printf("Your Total is Rs. %d",total);
break;
}
else
{
printf("*");
}
}
printf("\n");
}
getch();
}

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on Displaying Restaurant Bill HELP Please ! Or get search suggestion and latest updates.




Tagged: