Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
331 changes: 331 additions & 0 deletions BCT/Banking_system/Canteen Management and Billing System/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,331 @@
/*
PROJECT NAME --> CANTEEN MANAGEMENT AND BILLING SYSTEM
TEAM MEMBERS --> ROJAN BHATTARAI , SANDEEP JAISWAL , SAMIR ADHIKARI , RISHAV JAISWAL

*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define OWNER_PASSWORD "admin"


struct Menu {
int id;
char name[50];
float price;
};


void addItem() {
struct Menu items[100], item;
int count = 0, i;
FILE *fp = fopen("canteen.txt", "r");


if (fp != NULL) {
while (fscanf(fp, "%d %s %f", &items[count].id, items[count].name, &items[count].price) != EOF) {
count++;
}
fclose(fp);
}


printf("Enter Item ID: ");
scanf("%d", &item.id);


for (i = 0; i < count; i++) {
if (items[i].id == item.id) {
printf("Item ID already exists! Try again.\n");
return;
}
}

printf("Enter Item Name(Use '_' instead of spaces): ");
scanf(" %[^\n]s", item.name);
printf("Enter Item Price: ");
scanf("%f", &item.price);


items[count++] = item;
for (i = 0; i < count - 1; i++) {
for (int j = i + 1; j < count; j++) {
if (items[i].id > items[j].id) {
struct Menu temp = items[i];
items[i] = items[j];
items[j] = temp;
}
}
}


fp = fopen("canteen.txt", "w");
for (i = 0; i < count; i++) {
fprintf(fp, "%d %s %.2f\n", items[i].id, items[i].name, items[i].price);
}
fclose(fp);

printf("Item added successfully!\n");
}



void viewItems() {
struct Menu item;
FILE *fp = fopen("canteen.txt", "r");

if (fp == NULL) {
printf("Error opening file!\n");
return;
}

printf("\nID\tName\tPrice\n");
printf("----------------------------\n");
while (fscanf(fp, "%d %s %f", &item.id, item.name, &item.price) != EOF) {
printf("%d\t%s\t%.2f\n", item.id, item.name, item.price);
}

fclose(fp);
}



void deleteItem() {
struct Menu items[100];
int count = 0, deleteId, i, found = 0;
FILE *fp = fopen("canteen.txt", "r");

if (fp == NULL) {
printf("Error opening file!\n");
return;
}


while (fscanf(fp, "%d %s %f", &items[count].id, items[count].name, &items[count].price) != EOF) {
count++;
}
fclose(fp);
viewItems();

printf("Enter Item ID to delete: ");
scanf("%d", &deleteId);


for (i = 0; i < count; i++) {
if (items[i].id == deleteId) {
found = 1;
for (int j = i; j < count - 1; j++) {
items[j] = items[j + 1];
}
count--;
break;
}
}

if (!found) {
printf("Item not found!\n");
return;
}

fp = fopen("canteen.txt", "w");
for (i = 0; i < count; i++) {
fprintf(fp, "%d %s %.2f\n", items[i].id, items[i].name, items[i].price);
}
fclose(fp);

printf("Item deleted successfully!\n");
}



int ownerLogin() {
char password[50];
printf("Enter Admin Password: ");
scanf("%s", password);

if (strcmp(password, OWNER_PASSWORD) == 0) {
return 1;
} else {
printf("Incorrect password! Access denied.\n");
return 0;
}
}



void ownerSection() {
if (!ownerLogin()) {
return;
}

int choice;
while (1) {
printf("\nOwner Section\n");
printf("1. Add Item\n");
printf("2. Delete Item\n");
printf("3. View Items\n");
printf("4. Exit Owner Section\n");
printf("Enter your choice(numbers only): ");
scanf("%d", &choice);

switch (choice) {
case 1:
addItem();
break;
case 2:
deleteItem();
break;
case 3:
viewItems();
break;
case 4:
return;
default:
printf("Invalid choice! Please try again.\n");
}
}
}





void placeOrder() {
struct Menu item;
int orderId, quantity;
float total = 0;
FILE *fp = fopen("canteen.txt", "r");
FILE *orderFile = fopen("orders.txt", "a");

if (fp == NULL) {
printf("Error opening menu file!\n");
return;
}
if (orderFile == NULL) {
printf("Error opening orders file!\n");
fclose(fp);
return;
}

printf("\nAvailable Menu:\n");
viewItems();

printf("\nEnter Item ID to order (0 to finish): ");
scanf("%d", &orderId);

while (orderId != 0) {
printf("Enter Quantity: ");
scanf("%d", &quantity);

int found = 0;
rewind(fp);
while (fscanf(fp, "%d %s %f", &item.id, item.name, &item.price) != EOF) {
if (item.id == orderId) {
found = 1;
printf("Added %d x %s (%.2f each)\n", quantity, item.name, item.price);
total += item.price * quantity;


fprintf(orderFile, "Order ID: %d, Food Name: %s, Quantity: %d, Total Price: %.2f\n",
item.id, item.name, quantity, item.price * quantity);
break;
}
}

if (!found) {
printf("Item not found!\n");
}

printf("\nEnter Item ID to order (0 to finish): ");
scanf("%d", &orderId);
}

if (total > 0) {

fprintf(orderFile, "Total Order Price: %.2f\n", total);

fprintf(orderFile, "----------------------------------------\n");
printf("\nYour total bill is: %.2f\n", total);
} else {
printf("No items ordered.\n");
}

fclose(fp);
fclose(orderFile);
}



void orderSection() {
int choice;
while (1) {
printf("\nOrder Section\n");
printf("1. View Menu\n");
printf("2. Place Order\n");
printf("3. Exit\n");
printf("Enter your choice: ");
scanf("%d", &choice);

switch (choice) {
case 1:
viewItems();
break;
case 2:
placeOrder();
break;
case 3:
return;
default:
printf("Invalid choice! Please try again.\n");
}
}
}



int main() {
int choice;


while (1) {

printf("\n");
printf("========================================\n");
printf(" **** CANTEEN MANAGEMENT ****\n");
printf(" **** AND BILLING ****\n");
printf(" **** SYSTEM ****\n");
printf("========================================\n");
printf("\n");

printf("\n");
printf("1. Owner Login\n");
printf("2. Menu and Order\n");
printf("3. Exit\n");
printf("Enter your choice(numbers only): ");



if (scanf("%d", &choice) != 1) {
printf("Invalid input! Please enter a number.\n");
while (getchar() != '\n');
continue;

}

switch (choice) {
case 1:
ownerSection();
break;
case 2:
orderSection();
break;
case 3:
exit(0);
default:
printf("Invalid choice! Please try again.\n");

}
}

return 0;
}
Binary file not shown.
28 changes: 28 additions & 0 deletions BCT/Banking_system/Canteen Management and Billing System/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 🍽️ Canteen Management & Billing System

## 📌 Project Overview
The **Canteen Management & Billing System** is a C-based application designed to streamline the ordering, billing, and inventory management process in a canteen. This project automates manual processes, enhances efficiency, and provides an interactive and user-friendly interface for both customers and canteen staff.

## 🎯 Key Features
- 📋 **Menu Management:** Add, update, and remove food items dynamically.
- 💰 **Billing System:** Auto-generates bills based on user orders.
- 📦 **Inventory Tracking:** Keeps track of available stock.
- 🛒 **Order Processing:** Multiple order handling with easy modifications.
- 📊 **Report Generation:** Provides sales reports for better financial tracking.

## 💡 Project Concept
In a fast-paced environment like a canteen, manually managing orders and bills is inefficient and error-prone. Our system simplifies operations by integrating all essential features into a single platform, ensuring accuracy and saving time for both customers and staff.

## 👥 Team Members & Contributions
- **Samir Adhikari** → ✍️ Program Writer (Developed core functionality & logic)
- **Rishab Jaiswal** → 🎨 Layout Designer (Designed the workflow of the program)
- **Sandeep Jaiswal** → 🔍 Resources Collector (Gathered data & resources for project)
- **Rojan Bhattarai** → 🛠️ Program Tester & Leader (Debugging, testing & team coordination)

## 🛠️ Technologies & Tools Used
- **Programming Language:** C
- **Development Environment:** Code::Blocks / VS CODE
- **Libraries Used:** Standard C libraries for file handling, struct-based data management

## How to use the program
-Open the main.c file along with canteen.txt in your C compiler and run it
28 changes: 28 additions & 0 deletions BCT/Canteen-Management-and-Billing-System/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 🍽️ Canteen Management & Billing System

## 📌 Project Overview
The **Canteen Management & Billing System** is a C-based application designed to streamline the ordering, billing, and inventory management process in a canteen. This project automates manual processes, enhances efficiency, and provides an interactive and user-friendly interface for both customers and canteen staff.

## 🎯 Key Features
- 📋 **Menu Management:** Add, update, and remove food items dynamically.
- 💰 **Billing System:** Auto-generates bills based on user orders.
- 📦 **Inventory Tracking:** Keeps track of available stock.
- 🛒 **Order Processing:** Multiple order handling with easy modifications.
- 📊 **Report Generation:** Provides sales reports for better financial tracking.

## 💡 Project Concept
In a fast-paced environment like a canteen, manually managing orders and bills is inefficient and error-prone. Our system simplifies operations by integrating all essential features into a single platform, ensuring accuracy and saving time for both customers and staff.

## 👥 Team Members & Contributions
- **Samir Adhikari** → ✍️ Program Writer (Developed core functionality & logic)
- **Rishab Jaiswal** → 🎨 Layout Designer (Designed the workflow of the program)
- **Sandeep Jaiswal** → 🔍 Resources Collector (Gathered data & resources for project)
- **Rojan Bhattarai** → 🛠️ Program Tester & Leader (Debugging, testing & team coordination)

## 🛠️ Technologies & Tools Used
- **Programming Language:** C
- **Development Environment:** Code::Blocks / VS CODE
- **Libraries Used:** Standard C libraries for file handling, struct-based data management

## How to use it
-Open the main.c file along with canteen.txt and run it into your C compiler
6 changes: 6 additions & 0 deletions BCT/Canteen-Management-and-Billing-System/canteen.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
1 samosa 50.00
2 chowmein 50.00
3 momo 40.00
4 parotha 40.00
5 chanchiura 30.00
6 chiya 15.00
Binary file not shown.
Loading