can someone tell me why this code doesnt work?
#include <stdio.h>
#include <conio.h>
#include <ctype.h>
int main(void)
{
char c;
char option;
printf("\nMAIN MENU\n"
printf("\n1. Add Order\n"
printf("2. Chart\n"
printf("3. Percentage\n"
printf("4. Average\n"
printf("5. Total Cost\n"
printf("6. Exit\n"
printf("\nWhich menu would you like?"
scanf("%c", &c);
switch(c)
{
case '1' : addorder();
break;
case '2' : printf("\ndisplay chart here"
main ();
break;
case '3' : printf("\ndisplay percentage here"
main ();
break;
case '4' : printf("\naverage"
main ();
break;
case '5' : printf("\nTotal cost is "
main ();
break;
case '6' : printf("You chose to exit, press a button"
option = getch();
exit(0);
}
return 0;
}
int addorder()
{
int meal;
int side;
int portions;
float mealprice;
float sideprice;
float ordtotal;
printf("\nMain Meal "
printf("Side Order\n"
printf("\n1. Beef Burger @ 1.50 "
printf("6. Chips @ 1.60\n"
printf("2. Chicken Bites @ 1.80 "
printf("7. Salad @ 1.50\n"
printf("3. Vegetarian Burger @ 2.00 "
printf("8. Baked Potatoe @ 1.50\n"
printf("4. Breakfast Burger @ 1.50 "
printf("9. NONE @ 0.00\n"
printf("5. Scampi @ 1.50 \n"
printf("\nEnter Meal Number: "
scanf("%d", &meal);
printf("\nEnter Side Order Number: "
scanf("%d", &side);
printf("\nEnter Number of Portions: "
scanf("%d", &portions);
if(meal=="1" &&side=="6"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="1"&&side=="7"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="1"&&side=="8"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="1"&&side=="9"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="2"&&side=="6"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="2"&&side=="7"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="2"&&side=="8"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="2"&&side=="9"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="3"&&side=="6"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="3"&&side=="7"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="3"&&side=="8"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="3"&&side=="9"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="4"&&side=="6"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="4"&&side=="7"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="4"&&side=="8"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="4"&&side=="9"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="5"&&side=="6"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="5"&&side=="7"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="5"&&side=="8"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="5"&&side=="9"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
printf("\nOrder Total = %d", ordtotal);
main ();
}
#include <stdio.h>
#include <conio.h>
#include <ctype.h>
int main(void)
{
char c;
char option;
printf("\nMAIN MENU\n"
printf("\n1. Add Order\n"
printf("2. Chart\n"
printf("3. Percentage\n"
printf("4. Average\n"
printf("5. Total Cost\n"
printf("6. Exit\n"
printf("\nWhich menu would you like?"
scanf("%c", &c);
switch(c)
{
case '1' : addorder();
break;
case '2' : printf("\ndisplay chart here"
main ();
break;
case '3' : printf("\ndisplay percentage here"
main ();
break;
case '4' : printf("\naverage"
main ();
break;
case '5' : printf("\nTotal cost is "
main ();
break;
case '6' : printf("You chose to exit, press a button"
option = getch();
exit(0);
}
return 0;
}
int addorder()
{
int meal;
int side;
int portions;
float mealprice;
float sideprice;
float ordtotal;
printf("\nMain Meal "
printf("Side Order\n"
printf("\n1. Beef Burger @ 1.50 "
printf("6. Chips @ 1.60\n"
printf("2. Chicken Bites @ 1.80 "
printf("7. Salad @ 1.50\n"
printf("3. Vegetarian Burger @ 2.00 "
printf("8. Baked Potatoe @ 1.50\n"
printf("4. Breakfast Burger @ 1.50 "
printf("9. NONE @ 0.00\n"
printf("5. Scampi @ 1.50 \n"
printf("\nEnter Meal Number: "
scanf("%d", &meal);
printf("\nEnter Side Order Number: "
scanf("%d", &side);
printf("\nEnter Number of Portions: "
scanf("%d", &portions);
if(meal=="1" &&side=="6"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="1"&&side=="7"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="1"&&side=="8"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="1"&&side=="9"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="2"&&side=="6"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="2"&&side=="7"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="2"&&side=="8"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="2"&&side=="9"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="3"&&side=="6"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="3"&&side=="7"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="3"&&side=="8"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="3"&&side=="9"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="4"&&side=="6"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="4"&&side=="7"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="4"&&side=="8"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="4"&&side=="9"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="5"&&side=="6"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="5"&&side=="7"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="5"&&side=="8"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
else if(meal=="5"&&side=="9"
{
mealprice=1.50;
sideprice=1.50;
ordtotal=(mealprice+sideprice)*portions;
}
printf("\nOrder Total = %d", ordtotal);
main ();
}