C Language Mini Project 2021 | Mini Project with C Language | Best Mini project in C language

A restaurant has a need of a display board where they can serve their customer by giving comfort to them. m order are placed by n no. of customers on regular basics . The Menu list of the food items is as follow: 



Restaurant Menu:

Samosa 25

 Idli 35

 Vada_Pav 

25 Masala_

Dosa 50

 Sambhar_Vada 40 

Aloo_Paratha 30

 Cholae_Bhaturae 50 

Bread_Pakora 30

 Dahi_Kachori 40

 Bhel_Puri 50 

Sandwich 40


To create a program for Restaurant:



#include<stdio.h>

#include<string.h>

#include<ctype.h>



typedef struct 

{

    char name[20];

    int price;

} menu;





//Main

int main()

{

    int i,t;

    char q;

    menu a[20]={{"samosa",25},{"idli",35},{"kachori",20},{"dosa",30},{"coffee",60},{"vadapav",15}};

    



    for(int i=0; i<6; i++)

        printf("%s\t%d\n", a[i].name, a[i].price);

    printf("Enter Your Order:\n");

    for(int i=6;i<8;i++)

    scanf("%s",a[i].name);

    

    for(i=0;i<=strlen(a[6].name);i++)

    {

    a[6].name[i]=tolower(a[6].name[i]);

    }

    for(i=0;i<=strlen(a[7].name);i++)

    {

    a[7].name[i]=tolower(a[7].name[i]);

    }

   

   printf("Do you want to order more:(y,n)\n");

    scanf("%s",&q);

    

    if(q=='y')

    {

    printf("Enter Order:");

    scanf("%s",a[8].name);

    for(i=0;i<=strlen(a[8].name);i++)

    {

    a[8].name[i]=tolower(a[8].name[i]);

    }

    }

    else if(q=='n')

    {

    printf("Thank You:)have a nice day!!");

    }

    for(i=0;i<6;i++)

    {

    if(strcmp(a[6].name,a[i].name)==0)

    a[6].price=a[i].price;

    }

    for(i=0;i<6;i++)

    {

    if(strcmp(a[7].name,a[i].name)==0)

    a[7].price=a[i].price;

    }

    for(i=0;i<6;i++)

    {

    if(strcmp(a[8].name,a[i].name)==0)

    a[8].price=a[i].price;

    }

    printf("\nTotal Price:");

    t=a[6].price+a[7].price+a[8].price;

   

    printf("%d Rs\n",t);

    

}

Code written by Rohit Bairwa

Post a Comment

0 Comments