Restaurant Billing System
Projects in C

Restaurant Billing System in C Without Using Any Functions

Today, we are going to share information about Restaurant Billing System which we have made in C language. This is a complete project which will tell you everything about the restaurant which you do in the restaurant. We make this software without using any functions, arrays, strings, or structures.

Restaurant Billing System

We have created a project in C language that is Restaurant Billing System. This software can be used in restaurants where you can pay your bills easily. As we know that manual billing system is somehow tricky, and you have to hire some waiters for your work and for taking bills. With this software, you don’t need to hire waiters.

Features

This software will print your total bill automatically, you just have to select dishes and the number of dishes you want to eat. And in this software, we used nested switch statements and goto statements. This program has 3 cases of the switch and also it has 10 nested switch cases. This software has the following features:

  • Main menu
  • Bill payment
  • Total the bill
  • Exit

Program

In the previous article, we discussed Easy C Program to Insert a Number in an Array. but here in this article, we will only discuss Restaurant Billing System in C language without using any functions, arrays, strings, or any type of structure.

#include<stdio.h>
#include<stdlib.h>
int main()
{
    int menu,plates,items,bill1=0,bill2=0,bill3=0,bill4=0,bill5=0,bill6=0,bill7=0,bill8=0,bill9=0,bill10=0,
    total_bill,chicken_biryani=160,chicken_biryani_shami_kabab= 220,chicken_biryani_1_drink=190,
    chicken_biryani_shami_kabab_1_drink= 250,fish_per_kg= 600,fish_1_drink= 650,russian_salad= 100,
    sabzi= 150,Ice_cream_vanella_flavour= 130,Ice_cream_king_kolfa_flavour= 140;
    char choice;
        printf("\n~~~~~~Welcome to ocean View Restuarant~~~~~~\n\n");
    main:
    printf("\t[1] Main Menu\n\t[2] Bill Payment\n\t[3] Exit\n\nChoice is yours\n");
    scanf("%d",&menu);
    system("cls");
    switch(menu)
    {
        case 1:
    menu:
             printf("\n¬¬¬¬¬¬¬¬¬¬  Welcome to Main Menu  ¬¬¬¬¬¬¬¬¬\n\n");
            printf("\t[1] Chicken Biryani \t \t\t160Rs\n\t[2] Chicken Biryani+Shami Kabab  \t220Rs\n\t[3] Chicken Biryani+1 drink \t\t190Rs\n");
            printf("\t[4] Chicken Biryani+Shami Kabab+1drink  250Rs\n\t[5] Fish Per Kg \t\t\t600Rs\n\t[6] Fish+1 drink \t\t\t650Rs\n");
            printf("\t[7] Russian Salad \t\t\t100Rs\n\t[8] Sabzi  \t\t\t\t150Rs\n\t[9] Ice cream Vanella Flavour \t\t130Rs\n");
            printf("\t[10] Ice cream King Kolfa Flavour  \t140Rs\n\n");
            printf("Choose upto 10\n");
            scanf("%d",&items);
            system("cls");
            switch(items)
            {
                case 1:
                    printf("Chicken Biryani\n\n");
                    printf("Enter the plates you want to order:\n");
                    scanf("%d",&plates);
                    bill1=chicken_biryani*plates;
                 	printf("\nChicken Biryani= %dRs",bill1);
                    break;
                case 2:
                 	printf("Chicken Biryani+Shami Kabab\n\n");
                 	printf("Enter the plates you want to order:\n");
                    scanf("%d",&plates);
                    bill2=chicken_biryani_shami_kabab*plates;
                    printf("\nChicken Biryani+Shami Kabab= %dRs",bill2);
                    break;
                case 3:
                	printf("Chicken Biryani+1 drink\n\n");
                	printf("Enter the plates you want to order:\n");
                    scanf("%d",&plates);
                    bill3=chicken_biryani_1_drink*plates;
                    printf("\nChicken Biryani+1 drink= %dRs",bill3);
                	break;
                case 4:
                	printf("Chicken Biryani+Shami Kabab+1 drink\n\n");
                	printf("Enter the plates you want to order:\n");
                    scanf("%d",&plates);
                    bill4=chicken_biryani_shami_kabab_1_drink*plates;
                	printf("\nChicken Biryani+1 drink= %dRs",bill4);
                	break;
                case 5:
                	printf("Fish\n\n");
                	printf("Enter the plates you want to order:\n");
                    scanf("%d",&plates);
                    bill5=fish_per_kg*plates;
                    printf("\nFish= %dRs",bill5);
                	break;
                case 6:
                	printf("Fish+1 drink\n");
                	printf("Enter the plates you want to order:\n");
                    scanf("%d",&plates);
                    bill6=fish_1_drink*plates;
                    printf("Fish+1 drink= %dRs",bill6);
                	break;
                case 7:
                	printf("Russian Salad\n\n");
                	printf("Enter the plates you want to order:\n");
                    scanf("%d",&plates);
                    bill7=russian_salad*plates;
                    printf("\nRussian Salad= %dRs",bill7);	
                	break;
                case 8:
                	printf("Sabzi\n\n");
                	printf("Enter the plates you want to order:\n");
                    scanf("%d",&plates);
                    bill8=sabzi*plates;
                    printf("\nSabzi= %dRs",bill8);	
                	break;
                case 9:
                	printf("Ice cream Vanella Flavour\n\n");
                	printf("Enter the bowls you want to order:\n");
                    scanf("%d",&plates);
                    bill9=Ice_cream_vanella_flavour*plates;
                    printf("\nIce cream Vanella Flavour=%dRs",bill9);
                	break;
                case 10:
                	printf("Ice cream King Kolfa\n\n");
                	printf("Enter the bowls you want to order:\n");
                    scanf("%d",&plates);
                    bill10=Ice_cream_king_kolfa_flavour*plates;
                    printf("\nIce cream King Kolfa=%dRs",bill10);
                	break;
                default:
                	printf("Error... Please select upto 10.\a");
           	} 
                	printf("\n\nDO YOU WANT TO CONTINUE ON MENU\n(Press'y' for yes\nPress 'n'for No)\n");
                	scanf("%s",&choice);
                	system("cls");
               	if(choice=='y')
            	{
                	goto menu;
                }
                else if(choice=='n')
                    goto main;
            
        case 2:	
                printf("\n`````````Bill`````````\n\n");
                total_bill=bill1+bill2+bill3+bill4+bill5+bill6+bill7+bill8+bill9+bill10;
                printf("\nTotal Bill=%dRs\n\n",total_bill);
        	  	printf("/ / / / thanks for visiting \\ \\ \\ \\\n");
                break;   
        case 3: 
               printf("\n\nYou haven`t payed your bill. please pay your bill\a\n");
                  goto main;                   
                printf("Thanks\n");	
                break;
            
    }
}

First of all, we will declare and initialize integer type variables. All those will be the variables that we have needed in the menu section. We have taken almost 10 items in the menu section and declared them. The other variables we have used are menu, items, plates, bill1 up to bill10, and the total bill.

We will take another character type variable which is choice, this is for applying conditions. Now we will print some statements, then we will apply the switch statement on the menu variable. Then we will apply a nested switch statement inside the menu section which will be items, in which we will introduce 10 cases of items.

In each case, we will ask for plates to order and a formula to calculate the bill individually. And formula we will apply is like bill1=chicken biryani*plates; We have used a clear screen for clearing screen in each step. In the default section, we have applied a statement if the user will press any key other than 1 to 10 items.

After case 1, we have printed a statement which is like do you want to continue on the menu. If yes then press y and if no then press n. then we apply the if condition in which we apply condition which is choice==’y’. and we will then use the goto statement which will take control inside the menu. And if we press ‘n’ then control will move to the body of the main.

After that, we use case 2 which is bill payment, in which the user will pay their bill. And after case 3 is an exit from the program, and if somebody wants to go without paying the bill then there will be an error message with a beep sound will be produced and the message is you haven’t paid your bill, kindly pay your bill first. After paying the bill, thank you for visiting message will be displayed.

Output

  • First of all, you will be given 3 choices. Main menu, bill payment, and exit.
  • You have to select 1 option which is the main menu.

  • Then, a menu of items will be opened.
  • In this menu, you have to choose up to 10 items.
  • And if you select above then 10, then it will show an error message and return to the menu.

  • After selecting an item, you have to choose the plates of that item.
  • Then your bill for 1st item will be created.

  • After that, the software will ask you whether you want to continue on the menu.
  • And you have 2 options, yes and no.
  • If you press yes, then it will continue on the menu, and if no then it will return to 3 cases with the help of the goto statement.

  • After that, you have to select another item and the plates of that item.
  • The bill for that item will also be created.
  • Then again it will ask you whether you want to continue on the menu, then you have to select between yes and no.

  • After selecting items, you have to press the no option.
  • Then this will take you to 3 choices of which one is bill payment.

  • Then you have to choose 2 options which are bill payment in order to pay the bill.

  • After pressing on bill payment, your total bill will be printed in which the items you ordered will also be printed.
  • The price of each item will be attached to your bill.

  • And if someone wants to go without bill payment, then an error message will be displayed and a sound will be produced which is:

  • The error message will be as if you haven’t paid your bill. Please pay your bill first.
  • And with the help of goto, the software will open again the bill payment screen.

Conclusion

This is the whole software that will print and give you complete output. This software is time-saving, more accurate, and has fast calculations. Hence, a Restaurant Billing System is very necessary for restaurants. You don’t need waiters for orders. This software is working in foreign countries but is still not introduced in Pakistan. So, we must have this system in order to save time and for accurate calculation.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *