Canteen Management System in C with Source Code

This Canteen Management System project in C Language is a consoled based application created using c programming language. This system is a simple mini project and compiled in Code::Blocks IDE using GCC compiler. The canteen management system is specifically built for computing the entire cost in a canteen and adding the record of requested items.

This system elucidates the fundamental principle of storing and creating detailed information about ordered items. Staff can join up as a system admin in this system, giving them full access to the system for keeping daily records.

Canteen Management System using C language is an easy project for beginners to learn how to build a web-based C language project. We will provide you with the complete source code for the C project so that you can easily install it on your machine and learn how to program in C language.

This Canteen Management System project in C Framework, Also includes a Download Source Code for free, just find the downloadable source code below and click download now.

Anyway if you want level up your knowledge in programming especially C/C++ Programming Language, try this new article I’ve made for you Best C Projects with Source Code for Beginners Free Download 2022.

To start creating a Canteen Management System C Language , make sure that you have a Code Blocks or any platform of C installed in your computer.

ABOUT PROJECTPROJECT DETAILS
Project Name : Canteen Management System
Project Platform :C/C++
Programming Language Used:C Programming Language
Developer Name :itsourcecode.com
IDE Tool (Recommended):Dev-C++/Codeblocks
Project Type :Desktop Application
Database:Stores data in .DAT file
Canteen Management System Project in C Language with Source Code Overview

Features of Canteen Management System C Language w/ Source Code

  • Calculate Bills  – For the calculate bills, the user can view their bills after ordering a foods.
  • Add orders – For the add orders, the user can add new order of foods.
  • Edit Orders – For the edit orders, the user can edit their orders information.
  • Display orders – For the display orders, the user can view their orders.
  • Search orders – For the search orders, the user can search their orders.
  • Delete orders – For the delete orders, the user can delete their order information.
  • Exit – For the exit, the user can also exit in the system.

Canteen Management System C Language Steps on How to Create a Project

Time needed: 5 minutes

Here’s the step’s on how to create a Canteen Management System Project in C with Source Code.

  • Step 1: Create a new project.

    First open the code blocks IDE and click “create a new project“.
    Create a Project Name for Canteen Management System Project in C Language with Source Code

  • Step 2: Choose console application.

    Next, click the “console application” and after that click “next“.
    Click Console for Canteen Management System Project in C Language with Source Code

  • Step 3: Choose C language.

    Then , choose “C language” and click “next“.

  • Step 4: Name your project.

    Lastly, name the project you’ve created and click “next” after that click “finish“.

  • Step 5: The actual code.

    Finally, we will now start adding functionality to our C Framework by adding some functional codes.

Functionality and Codes

  • Create to display menu

In this section, we will learn on how create a menu to display in the screen. To start with, add the following code in your main.c

void displayCanteen_mainmenu()
{
    int i;
    char ch;
    const char *menu[]= {"   Calculate Bill","   Order Items","   Edit Items","   Display Orders  ","   Search Orders", "   Delete Orders","   Exit"};
    system("cls");

    mainScreenWindow(25,50,20,32);
    gotoxy(33,18);
    printf("\n\t\t\t\t        ++++++++++++++++++++++++++++++++++++++++++++++++      ");
    printf("\n\t\t\t\t        +                 CANTEEN FETAURES             +      ");
    printf("\n\t\t\t\t        ++++++++++++++++++++++++++++++++++++++++++++++++      ");
    
    for (i=0; i<=6; i++)
    {
        gotoxy(30,22+i+1);
        printf("%s\n\n\n",menu[i]);
    }
    keyboard(7);
}

 

  • Create search window

In this section, we will learn on how create a search window. To start with, add the following code in your main.c

void displaySearching()
{
    char ch;
    int i;
    const char *menu[]= {"   By Code","   By Rate","   By Quantity","   Back to main menu"};
    system("cls");

    mainScreenWindow(25,50,20,32);
    gotoxy(33,18);
    printf("SEARCH MENU");
    for (i=0; i<=3; i++)
    {
        gotoxy(30,22+i+1);
        printf("%s\n\n\n",menu[i]);
    }
    keyboard(4);
}

  • Create billing window

In this section, we will learn on how create a billing window. To start with, add the following code in your main.c

void canteenBilling()
{
    char x[4]= {0};
    int j=29,q=0,size=0,i=1;
    float total=0,gtotal=0;
    FILE *file;
    file=fopen("record.txt","r+b");
    rewind(file);
    system("cls");
    canteenBill();
    gotoxy(26,15);
    printf("Enter  \"end\" to finish input");
    while(1)
    {
        gotoxy(25,18);
        printf("                    ");
        gotoxy(25,19);
        printf("                    ");
        gotoxy(25,18);
        printf("Enter Item Code:");
        scanf("%s",x);
        if(strcmp(x,"end")==0)
            break;
        gotoxy(25,19);
        printf("Enter Quantity:");
        scanf("%d",&q);
        rewind(file);
        while(fread(&item,sizeof(item),1,file))
        {
            if((strcmp(item.code,x)==0))
            {
                total=item.rate*q;
                gotoxy(11,j);
                printf("%4d",i);
                printf("%9s",item.name);
                printf("%13d",q);
                printf("%15.2f",item.rate);
                printf("%13.2f",total);
                gtotal=gtotal+total;
                size=sizeof(item);
                item.quantity=item.quantity-q;
                j+=2;
                i++;
                fseek(file,-size,SEEK_CUR);
                fwrite(&item,sizeof(item),1,file);
                break;
            }
        }
    }
    if(gtotal!=0)
    {
        gotoxy(30,j+5);
        printf("TOTAL AMOUNT = Php%6.2f",gtotal);
    }
    fclose(file);
    getch();
    displayCanteen_mainmenu();
}

  • Create add food window

In this section, we will learn on how create the all add food window. To start with, add the following code in your main.c

void canteenAdding ()
{
    FILE *file;
    char y[ACS],x[12];
    system("cls");

    gotoxy(25,25);
    printf("Enter New Food(Y/N)?");
    while(toupper(getche())=='Y')
    {
        system("cls");
        file=fopen("record.txt","ab");
        canteenCoding(y);
        strcpy(item.code,y);
        gotoxy(22,28);
        printf("Enter Rate Of The Item:");
        scanf("%f",&item.rate);
        gotoxy(22,30);
        printf("Enter Quantity Of The Item:");
        scanf("%d",&item.quantity);
        gotoxy(22,32);
        printf("Enter Name Of The Item:");
        scanf("%s",item.name);
        fseek(file,0,SEEK_END);
        fwrite(&item,sizeof(item),1,file);
        fclose(file);
        gotoxy(22,34);
        printf("Enter New Food(Y/N)?");

    }
    displayCanteen_mainmenu();
}

Downloadable Source Code

Summary

In summary, this Canteen Management System Project in C Language with Source Code can be useful to students or professional who wants to learn C Programming Language. This project can also be modified to fit your personal requirements. Hope this project will help you to improve your skills. Happy Coding!

Inquiries

If you have any questions or suggestions about Canteen Management System Project in C Language with Source Code, please feel free to leave a comment below.

Leave a Comment