change the code to C language
change the code to C language
#include<stdio.h>
#include<conio.h>
void menu();
void getInput( char &, int & );
float getprice( char ch , int n);
int main()
{
char name[20], order[3][20];
int table, quantity[3];
char ch1,ch2,ch3;
int n1,n2,n3;
float price=0;
float total=0;
float pay=0;
float change=0;
int q1;
int q2;
int q3;
printf ("\t -----------SUNNY CAFE ORDER FORM-----------\n");
printf("\t Customer Name :");
scanf("\n%s",&name);
printf("\t Table Number :");
scanf("\n%d", &table);
menu();
printf("\n\t Order 1: ");
getInput(ch1, n1);
printf("\t Order 1 quantity: ");
scanf("%d", &q1);
printf("\n");
printf("\t Order 2: ");
getInput(ch2, n2);
printf("\t Order 2 quantity: ");
scanf("%d", &q2);
printf("\n");
printf("\t Order 3: ");
getInput(ch3, n3);
printf("\t Order 3 quantity: ");
scanf("%d", &q3);
printf("\n");
printf ("\t\t **********************************************\n");
printf(" ~SUNNY CAFE~ \n");
printf ("\t\t ***********************************************\n");
printf("\t\t Customer Name: %s\n", name);
printf("\t\t Table Number: %d\n", table);
price = getprice(ch1, n1);
printf("\t %c%d x %d = %.2f\n", ch1, n1, q1, q1*price);
total=total+ q1*price;
price = getprice(ch2, n2);
printf("\t %c%d x %d = %.2f\n", ch2, n2, q2, q2*price);
total=total+ q2*price;
price = getprice(ch3, n3);
printf("\t %c%d x %d = %.2f\n", ch3, n3, q3, q3*price);
total=total+ q3*price ,"\n";
printf("\t Total bill: RM %.2f\n", total);
printf("\t Customer paid:");
scanf("%f", &pay);
change= pay-total;
printf("\t Balance: RM %.2f \n\n", change);
printf("\t Please Come Again!\n");
getch();
return 0;
}
float getprice( char ch , int n)
{
const float F1=13.50;
const float F2=10.50;
const float F3=10.00;
const float F4=12.50;
const float F5=8.90;
const float D1=5.90;
const float D2=4.90;
const float D3=6.50;
const float D4=0.50;
const float D5=2.00;
if(ch=='f')
{
switch(n)
{
case 1:
return F1;
case 2:
return F2;
case 3:
return F3;
case 4:
return F4;
case 5:
return F5;
}
}
else if(ch=='d')
{
switch(n)
{
case 1:
return D1;
case 2:
return D2;
case 3:
return D3;
case 4:
return D4;
case 5:
return D5;
}
}
}
void getInput( char &ch, int &n )
{
scanf("\t %c%d", &ch, &n);
}
void menu()
{
printf("\t\t ~~~~~~~~~~~~SUNNY CAFE MENU~~~~~~~~~~~~\n");
printf("\t Food Menu:\n");
printf("\t f1 - Burger (RM13.50)\n");
printf("\t f2 - Sandwich (RM10.50)\n");
printf("\t f3 - Hotdog (RM10.00)\n");
printf("\t f4 - Pasta (RM12.50)\n");
printf("\t f5 - Mushroom Soup (RM8.90)\n");
printf("\t Drinks Menu:\n");
printf("\t d1 - Coffee (RM5.90)\n");
printf("\t d2 - Tea (RM4.90)\n");
printf("\t d3 - Juice (RM6.50)\n");
printf("\t d4 - Sky Juice (RM0.50)\n");
printf("\t d5 - Fizy (RM2.00)\n");
}
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 3 steps with 7 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)