please help , grand total not working and lunch not working
Code:
#include <stdio.h>
#include <ctype.h>
#include <windows.h>
void bfast();
void lunch();
void dinner();
void bill();
void m_m();
void exit();
void fastfood();
void riceitem();
int num,i,lunch1;
float price;
float total;
float sum;
float grand;
char choice;
int again;
float total13;
float total11;
float total12;
float total0[3];
int main()
{
m_m();
}
void m_m() // main menu screen
{
char choice = ' ' ;
printf("+======================================================+\n ");
printf("|******************************************************|\n ");
printf("| Aslamalikum Sir/Mam. |\n ");
printf("| Hope you are having a Good day ! | \n ");
printf("| Welcome to our Dhaba |\n ");
printf("|******************************************************|\n ");
printf("+======================================================+\n\n");
printf(" && Please select the meal that you would like to purchase. && \n\n");
printf("\t\t [1] Nashta\n");
printf("\t\t [2] Lunch\n");
printf("\t\t [3] Dinner\n");
printf("\t\t [4] Exit\n\n");
printf("Enter your choice here : ");
scanf("%c", &choice);
system("cls");
switch (toupper(choice))
{
case '1':
bfast();
break;
case '2':
lunch();
break;
case '3':
dinner();
break;
case '4':
exit();
default:
m_m();
break;
}
}
void bfast()
{
int choice= 0;
int quantity= 0;
int again= 0;
float total1=0;
float total2=0;
float total3=0;
float total4=0;
float total5=0;
fflush(stdin);
printf("+======================================================+\n ");
printf("|******************************************************|\n ");
printf("| Aslamalikum Sir/Mam. )) |\n ");
printf("| Hope you are having a Good day ! | \n ");
printf("| Welcome to our Dhaba |\n ");
printf("| ***Nashty ka menu**** |\n " );
printf("|******************************************************|\n ");
printf("+======================================================+\n\n");
printf(" && Ap kia Nashta pasand Karengy. && \n\n");
printf("\t\t [1] Anda - PKR 30.0\n");
printf("\t\t [2] Paratha - PKR 15.0\n");
printf("\t\t [3] Chai- PKR 30.0\n");
printf("\t\t [4] chana salan- PKR 30.0\n");
printf("\t\t [5] mix sabzi - PKR 50.0\n");
printf("Enter your choice here : ");
scanf("%d", &choice);
{
if ( choice == 1 )
{
printf(" quantity : ");
scanf("%d", &quantity);
total5 = 30.00 * quantity;
printf("Apki abi tak ki wajibat rakam hai : PKR %.2f ,\n\n\n ", total5);
if ( choice == 2 )
{
printf(" quantity : ");
scanf("%d", &quantity);
total1= 15 * quantity ;
printf(" Apki abi tak ki wajibat rakam hai : PKR : %.2f\n\n\n ", total1);
}
}
else
if ( choice == 3 )
{
printf(" Ap kitny lena chahengy : ");
scanf("%d", &quantity);
total2 = 30 * quantity ;
printf(" Apki abi tak ki wajibat rakam hai : PKR : %.2f\n\n\n ", total2);
}
else
if ( choice == 4 )
{
printf(" Ap kitny lena chahengy : ");
scanf("%d", &quantity);
total3 = 30 * quantity ;
printf(" Apki abi tak ki wajibat rakam hai : PKR : %.2f\n\n\n ", total3);
}
else
if ( choice == 5 )
{
printf(" Ap kitny lena chahengy : ");
scanf("%d", &quantity);
total4 = 50 * quantity ;
printf(" Apki abi tak ki wajibat rakam hai : PKR : %.2f\n\n\n ", total4);
}
printf("\nKia ap kuch or lena pasand karengy?\n[1] G , [2] Nai: ");
scanf("%d", &again);
system("cls");
if (again == 1 )
{
bfast();
}
else
if (again == 2 )
{
bill();
exit();
}
else
if (again != 1 , 2)
{
printf("\n\n\t\t\tApka indarag galat hai !n\n\n\n");
m_m();
}
total11=total1+total2+total3+total4+total5;
total0[0]=total11;
printf("\n%.2f",total11);
}
}
void lunch()
{
int choice=0;
int choice1=0;
int quantity=0;
int again=0;
printf("+======================================================+\n ");
printf("|******************************************************|\n ");
printf("| Aslamalikum Sir/Mam. |\n ");
printf("| Hope you are having a Good day ! | \n ");
printf("| Welcome to our Dhaba |\n ");
printf("| ***lunch ka menu**** |\n " );
printf("|******************************************************|\n ");
printf("+======================================================+\n\n");
printf(" '\n");
printf(" && Ap kia lunch pasand Karengy. && \n\n");
printf("\t\t [1] RICE ITEMS\n");
printf("\t\t [2] FAST FOOD\n");
printf(" &&& Apni pasand likhye &&& : ");
scanf("%d", &choice);
switch (choice)
{
case '1':
riceitem();
break;
case '2':
fastfood();
break;
default:
m_m();
break;
}
}
void riceitem()
{
int choice1;
int quantity;
int again;
float total11=0;
float total10=0;
float total9=0;
float total8=0;
float total7=0;
float total6=0;
printf("\t\t [1] Chicken Biryani- PKR 120\n");
printf("\t\t [2] Beef Biryani- PKR 150 \n");
printf("\t\t [3] Chicken Pulao - PKR 150\n");
printf("\t\t [4] Beef Pulao - PKR 120\n");
printf("\t\t [5] Fried rice- PKR 150\n");
printf("\t\t [6] Fried Chicken rice- PKR 150\n");
printf(" &&& Apni pasand likhye &&& : ");
scanf("%d", &choice1);
if ( choice1 == 1 )
{
printf(" Ap kitny lena chahengy : ");
scanf("%d", &quantity);
total11 = 120 * quantity ;
}
if ( choice1 == 2 )
{
printf("Ap kitny lena chahengy : ");
scanf("%d", &quantity);
total10= 150 * quantity ;
}
if ( choice1 == 3 )
{
printf(" Ap kitny lena chahengy : ");
scanf("%d", &quantity);
total9= 150 * quantity ;
}
else
if ( choice1 == 4 )
{
printf(" Ap kitny lena chahengy : ");
scanf("%d", &quantity);
total8 = 120 * quantity ;
printf(" Apki abi tak ki wajibat rakam hai : PKR : %.2f\n\n\n ", total8);
}
else
if ( choice1 == 5 )
{
printf(" Ap kitny lena chahengy : ");
scanf("%d", &quantity);
total7 = 150 * quantity ;
printf(" Apki abi tak ki wajibat rakam hai : PKR : %.2f\n\n\n ", total7);
}
else
if ( choice1 == 6 )
{
printf(" Ap kitny lena chahengy : ");
scanf("%d", &quantity);
printf(" Apki abi tak ki wajibat rakam hai : PKR : %.2f\n\n\n ", total6);
}
}
void fastfood()
{
int choice1=0;
int quantity=0;
int again=0;
float total12=0;
float total13=0;
float total15=0;
float total14=0;
float total17=0;
float total16=0;
printf("\t\t [1] Chicken Broast- PKR 150\n");
printf("\t\t [2] Spicy Broat- PKR 170 \n");
printf("\t\t [3] Chicken Burger - PKR 160\n");
printf("\t\t [4] Beef Burger - PKR 150\n");
printf("\t\t [5] zinger- PKR 180\n");
printf("\t\t [6] Mighty zinger PKR 250\n");
printf(" &&& Apni pasand likhye &&& : ");
scanf("%d", &choice1);
if(choice1 == 1)
{
printf(" Ap kitny lena chahengy : ");
scanf("%d", &quantity);
total17 = 150 * quantity ;
printf("Apki abi tak ki wajibat rakam hai : PKR %.2f ,\n\n\n ", total17);
}
else
if ( choice1 == 2)
{
printf("Ap kitny lena chahengy : ");
scanf("%d", &quantity);
total14 = 170 * quantity ;
printf(" Apki abi tak ki wajibat rakam hai : PKR : %.2f\n\n\n ", total14);
}
else
if ( choice1 == 3)
{
printf(" Ap kitny lena chahengy : ");
scanf("%d", &quantity);
total15 = 160 * quantity ;
printf(" Apki abi tak ki wajibat rakam hai : PKR : %.2f\n\n\n ", total15);
}
else
if ( choice1 == 4 )
{
printf(" Ap kitny lena chahengy : ");
scanf("%d", &quantity);
total13= 150 * quantity ;
printf(" Apki abi tak ki wajibat rakam hai : PKR : %.2f\n\n\n ", total13);
}
else
if ( choice1 == 5 )
{
printf(" Ap kitny lena chahengy : ");
scanf("%d", &quantity);
total12 = 150 * quantity ;
printf(" Apki abi tak ki wajibat rakam hai : PKR : %.2f\n\n\n ", total12);
}
else
if ( choice1 == 6 )
{
printf(" Ap kitny lena chahengy : ");
scanf("%d", &quantity);
total16 = 250 * quantity ;
printf(" Apki abi tak ki wajibat rakam hai : PKR : %.2f\n\n\n ", total16);
}
printf("\nKia ap kuch or lena pasand karengy?\n[1] G , [2] Nai: ");
scanf("%d", &again);
system("cls");
if (again == 1 )
{
lunch();
}
else
if (again == 2 )
{
bill();
exit();
}
else
if (again != 1 , 2)
{
printf("\n\n\t\t\tApka indarag galat hai !n\n\n\n");
m_m();
}
}
void dinner()
{
int choice;
int quantity;
int again;
float total14=0;
float total12=0;
float total13=0;
printf("+======================================================+\n ");
printf("|******************************************************|\n ");
printf("| Aslamalikum Sir/Mam. |\n ");
printf("| Hope you are having a Good day ! |\n ");
printf("| Welcome to our Dhaba |\n ");
printf("| ***Dinner ka menu**** |\n ");
printf("|******************************************************|\n ");
printf("+======================================================+\n\n");
printf(" && Please select the food that you would like to purchase. && \n\n");
printf("\t\t [1] Chicken Chop - 650\n");
printf("\t\t [2] Spagetti - 550\n");
printf("\t\t [3] Chicken Burger - 400\n");
printf("&&& Apni pasand likhye &&& : ");
scanf("%d", &choice);
{
if (choice == 1)
{
printf(" quantity : ");
scanf("%d", &quantity);
total14 = 650 * quantity ;
printf(" Apki abi tak ki wajibat rakam hai : PKR : %.2f\n\n\n ", total14);
}
else
if ( choice == 2)
{
printf("quantity : ");
scanf("%d", &quantity);
total12 = 550 * quantity ;
printf(" Apki abi tak ki wajibat rakam hai : PKR : %.2f\n\n\n ", total12);
}
else
if ( choice == 3 )
{
printf("quantity : ");
scanf("%d", &quantity);
total13 = 400 * quantity ;
printf(" Apki abi tak ki wajibat rakam hai : PKR : %.2f\n\n\n ", total13);
}
printf("\nKia ap kuch or lena pasand karengy?\n[1] G , [2] Nai: ");
scanf("%d", &again);
system("cls");
if (again == 1 )
dinner();
else
if (again == 2 )
{
bill();
exit();
}
else
if (again != 1 , 2)
{
printf("\n\n\t\tApka indarag galat hai !\n\n\n\n");
m_m();
}
}
total13=total14+total12+total13;
total0[2]=total13;
}
void exit()
{
printf("\n+====================================================+\n ");
printf("\n|****************************************************|\n ");
printf("\n| Aslamalikum Sir/Mam. |\n ");
printf("\n| Hope you are having a Good day ! |\n ");
printf("\n|****************************************************|\n ");
printf("\n|****************************************************|\n ");
printf("\n| Thank You Very Much |\n ");
printf("\n| +============================+ |\n\n");
printf("\n| && Please come again. && \n\n |\n");
printf("\n+====================================================+\n ");
printf("\n|****************************************************|\n ");
}
void bill()
{
total0[3]=total0[0]+total0[1]+total0[2];
printf("\n| grand total : %.2f |\n",total0[3]);
}