Thread: pogram not shoing grand total =0 , tried alot

  1. #1
    Registered User
    Join Date
    Apr 2017
    Posts
    4

    pogram not shoing grand total =0 , tried alot

    Code:
    #include <stdio.h>        
    #include <ctype.h>
    #include <windows.h>
    
    
    void bfast();        
    void lunch();
    void dinner();
    void bill();
    void m_m(); 
    void exit();
    
    
    
    
    int num,i;    
    float price;
    float total;
    float sum;
    float  grand;
    char choice;
    int again;
    float total13;
    float total11;
    float total12;
    double 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); 
           printf("\nKia ap kuch or lena pasand karengy?\n[1] G , [2] Nahi : "); 
                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 Apka indarag galat hai ! \n\n\n\n");
                     m_m();
                    }
          }
              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);
              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 Apka indarag galat hai !\n\n\n\n");
                     m_m();
                }
                }
              
              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);
                 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();
                        }  
                 }
              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);
                 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();
                        }  
                  }
              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;
    }
    
    
    }
    
    
    void lunch()
    {
      int choice; 
      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("+======================================================+\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);
      {
      if ( choice == 1 ) 
           {
            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 ;
                
                printf("Apki abi tak ki wajibat rakam hai : PKR %.2f ,\n\n\n ", total11); 
                printf("\nKia ap kuch or lena pasand karengy?\n[1] G , [2] Nahi : "); 
                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 Apka indarag galat hai ! \n\n\n\n");
                    m_m();
                   }        
            }
    
    
              if ( choice1 == 2 )
              {
              printf("Ap kitny lena chahengy : ");
              scanf("%d", &quantity);
              total10= 150 * quantity ;
               
              printf(" Apki abi tak ki wajibat rakam hai : PKR : %.2f\n\n\n ", total10);
              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 Apka indarag galat hai !\n\n\n\n");
                     m_m();
                    }
        }
              
              
                 if ( choice1 == 3 )
                  {
                  printf(" Ap kitny lena chahengy : ");
                  scanf("%d", &quantity);
                  total9= 150 * quantity ;
        
                 printf(" Apki abi tak ki wajibat rakam hai : PKR : %.2f\n\n\n ", total9);
                 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();
                        }  
             }
              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);
                 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();
                        }  
            }
                  
                 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);
                 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();
                        }
            }
          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);
                 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();
                        }     
                }
    total12=total10+total11+total9+total8+total7+total6;
    total0[1]=total12;
    }
    }
    
    
    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);
            {
            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();
                }
                
            }
          }
        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);
                {
                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();
                    }        
                }
              }
              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();
                        }
                
                     }
                  }
    
    
                     else 
                         if (choice != 1 , 2 , 3)
                            {
                            fflush(stdin);
                            system("cls");
                            printf("\n\n\t\tApka indarag galat hai !\n\n\n\n");
                            dinner();
                            }
        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 ");
       }
    void bill()
    {
    total0[3]=total0[0]+total0[1]+total0[2];
    
    
      printf("\n|****************************************************|\n ");
      printf("\n|                  Thank You Very Much               |\n ");
      printf("\n|            +============================+          |\n\n");
      printf("\n|            && Please come again. && \n\n           |\n");
      printf("\n|                 grand total : %.2lf                 |\n",total0[3]);
      printf("\n+====================================================+\n ");
      printf("\n|****************************************************|\n ");
    
    
    }

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. array add total rows and total colms
    By gameover6005 in forum C Programming
    Replies: 1
    Last Post: 04-16-2013, 11:46 PM
  2. Replies: 1
    Last Post: 10-10-2009, 11:06 AM
  3. can u help me understand what this pogram does?
    By EdwardElric in forum C Programming
    Replies: 9
    Last Post: 10-26-2007, 02:44 PM
  4. grand total
    By gunshipolitico in forum C++ Programming
    Replies: 1
    Last Post: 11-13-2005, 08:57 PM
  5. I want to make a pogram that captures another program's HWND.
    By Queatrix in forum Windows Programming
    Replies: 4
    Last Post: 07-26-2005, 03:07 PM

Tags for this Thread