struct restaurant
{
int no;
float total;
char item [20];
};
void main ()
{
struct restaurant bill [20];
int i,x=0,d;
char ch;
double tot=0;
clrscr ();
printf("\n Menu Card \n");
printf("\n Item Price/Plate \n");
printf("\n1. Chicken Byriani Rs.120 \n");
printf("\n2. Mutton Byriani Rs.150 \n");
printf("\n3. Mutton Chap Rs.100 \n");
printf("\n4. Chicken Leg Rs.75 \n");
for (i=0;i<20;i++)
{
printf ("Enter the Item No: ");
scanf("%d",&d);
if(d==1)
strcpy(bill[i].item, "Chicken Byriani");
else if(d==2)
strcpy(bill[i].item, "Mutton Byriani");
else if(d==3)
strcpy(bill[i].item, "Mutton Chap");
else if(d==4)
strcpy(bill[i].item, "Chicken Leg");
printf ("Enter the number of plates : ");
scanf ("%d", &bill [i].no);
if(d==1)
bill[i].total=bill[i].no*120;
else if(d==2)
bill[i].total=bill[i].no*150;
else if(d==3)
bill[i].total=bill[i].no*100;
else if(d==4)
bill[i].total=bill[i].no*75;
printf("\nAny More Item (y/n):");
ch=getche();
if(ch=='n')
break;
}
x=i+1;
for(i=0;i<x;i++)
{
tot+=bill[i].total;
printf ("\n%s %d %.2f",bill[i].item, bill[i].no, bill[i].total);
}
printf("\nTotal Payable Amount: %.2f",tot);
getch ();
}
No comments:
Post a Comment