0% found this document useful (0 votes)
3 views

Restaurant Management System

The document outlines a Restaurant Management System implemented in C++ that allows users to place food orders, manage menus, and save order details to a file. It includes functionalities for displaying menus, taking orders, and handling user authentication for employees and customers. The program also provides instructions for food delivery and maintains a structured menu with various food and drink options.

Uploaded by

outsmartsolution
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Restaurant Management System

The document outlines a Restaurant Management System implemented in C++ that allows users to place food orders, manage menus, and save order details to a file. It includes functionalities for displaying menus, taking orders, and handling user authentication for employees and customers. The program also provides instructions for food delivery and maintains a structured menu with various food and drink options.

Uploaded by

outsmartsolution
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 23

Name Talha Muhammad Yasin

Reg id 241874
section 1c
Restaurant Management System

Code:

#include <iostream>

#include <string>

#include <vector>

#include <fstream>

#include <windows.h>

#include <iomanip> // For setting precision

#include <conio.h>

using namespace std;

void choice12();

void mainFunctionEMP();

double total = 0.0;

string FinalMenu;

string name;

string address;

// Structure for menu items

struct MenuItem {

string name;
float price;

};

// Function to display the menu

//added setprecision to limit the flaot decimal point to 2 setprecision(2)

void displayMenu(const vector<MenuItem>& menu) {

cout << "Menu:\n";

for (size_t i = 0; i < menu.size(); ++i) {

cout << (i + 1) << ". " << menu[i].name << " ($" << fixed << setprecision(2) << menu[i].price << ")\n";

// Function to place an order

void placeOrder(const vector<MenuItem>& menu) {

int choice;

vector<MenuItem> order;

while (true) {

system("cls");

cout << "\n\t\tEnter the Item Number to add to your order:\n\n";

cout << "Press 0 to finish order.\n";

displayMenu(menu);

cin >> choice;

if (choice == 0) {

system("cls");

cout << "Do you want to add more orders? Y = Yes, N = No" << endl;
cout << "Choose: ";

char lp;

cin >> lp;

if (lp == 'y' || lp == 'Y')

choice12();

else

break;

else if (choice >= 1 && choice <= static_cast<int>(menu.size())) {

order.push_back(menu[choice - 1]);

total += menu[choice - 1].price;

FinalMenu += menu[choice - 1].name + ", ";

cout << "Added " << menu[choice - 1].name << " to your order.\n";

cout << "Current Total: $" << fixed << setprecision(2) << total << endl;

Sleep(1000); // fake delay to show processing

else {

cout << "Invalid choice. Try again.\n";

Sleep(1000); // fake delay to show processing

cout << "Processing order..." << endl;

Sleep(2000); // fake delay to show processing

system("cls");
if (order.empty()) {

cout << "No items in the order.\n";

return;

// Show final order and total

cout << "Your order:\n";

FinalMenu.pop_back();

cout << FinalMenu;

cout << endl;

cout << endl;

cout << "Total: $" << fixed << setprecision(2) << total << endl;

ofstream outFile("order_details.txt", ios::app); // Append mode

if (outFile.is_open()) {

outFile << "Customer Name: " << name << endl;

outFile << "Customer Address: " << address << endl;

outFile << "Ordered Items: " << FinalMenu << endl;

outFile << "Total Amount: $" << fixed << setprecision(2) << total << endl;

outFile << "----------------------------------------" << endl;

outFile.close();

cout << "Order details saved to order_details.txt" << endl;

else {

cout << "Unable to open file to save order details." << endl;

}
int main()

string fname, lname;

cout << "\t\t\t\t _______________________________________ \n";

cout << "\t\t\t\t|Subject : Programming Fundamentals|\n";

cout << "\t\t\t\t|Semester : 1st |\n";

cout << "\t\t\t\t|To : Dr. Sumaira Hayat Khan |\n";

cout << "\t\t\t\t|From : Rana Abdullah (241943) |\n";

cout << "\t\t\t\t| Talha Yasin (241874) |\n";

cout << "\t\t\t\t| Salar Khan (241922) |\n";

cout << "\t\t\t\t|_______________________________________|\n";

cout << "\t\t\t\t| This Program is our Project. |\n";

cout << "\t\t\t\t|_______________________________________|\n";

cout << "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\tPLEASE KEEP PATIENCE. APP IS LOADING...";


Sleep(4000);

system("cls");

cout << "\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\t\t\t\t LOADING........." << endl;

cout << "\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\t\t\t\t\t\t\t\t\t\t " << endl;

cout << setw(57) << "\t\t\t\t ___________________________________________________________"


<< endl;

cout << setw(57) << "\t\t\t\t| |" << endl;

cout << setw(57) << "\t\t\t\t| DEVELOPED BY Abdullah, Talha and Salar |" << endl;

cout << setw(57) << "\t\t\t\t|


___________________________________________________________|" << endl;

Sleep(2000);

system("cls");

cout << "\t\t\t_____________________________________________________________" << endl;

cout << "\t\t\t| |" << endl;

cout << "\t\t\t| A BBBBBBBB |" << endl;

cout << "\t\t\t| AA B B |" << endl;

cout << "\t\t\t| A A B B |" << endl;

cout << "\t\t\t| A A BBBBBBBB |" << endl;

cout << "\t\t\t| AAAAAAAAA B B |" << endl;

cout << "\t\t\t| A A B B |" << endl;

cout << "\t\t\t| A A B B |" << endl;

cout << "\t\t\t| A A BBBBBBBB |" << endl;

cout << "\t\t\t| |" << endl;


cout << "\t\t\t|___________________________________________________________|" << endl;

cout << "\n\n\t\t\tWelcome to our online food delivery service!" << endl;

cout << "\t\t\tHere are some important rules to follow:" << endl;

cout << "-------------\n";

cout << "Instructions:\n";

cout << "-------------";

cout << "\n\n1. Ensure that the food has proper packaging to maintain freshness." << endl;

cout << "2. Keep track of temperature control during delivery." << endl;

cout << "3. Avoid physical and chemical contamination." << endl;

cout << "4. Be aware of allergens and label them appropriately." << endl;

cout << "5. include any conditions or deadlines for requesting refunds." << endl;

cout << "6. Send order confirmation and delivery updates via SMS or
email([email protected])" << endl;

Sleep(4000);

system("cls");

bool loop = true;

char selected;

while (loop)

int choiceOfPortal;

cin.ignore();
cout << "\n\n\t\t\t\t\tPlease Select the Category:" << endl;

cout << "\t\t\t\t\t---------------------------\n\n\n";

cout << "\n\n\n\t\t\t\t _____________ ______________" << endl;

cout << "\t\t\t | | | |" << endl;

cout << "\t\t\t | 1.Employee | | 2.Customer |" << endl;

cout << "\t\t\t |_____________| |______________|" << endl;

cout << endl;

cout << "Choose 1 or 2: ";

selected = _getch();

if (selected == '1')

while (true)

string username;

int password;

cout << endl;

cout << "Enter the Username : ";

cin >> username;

if (username == "admin") {

// Username is valid

else {

cout << "Invalid Username" << endl;

_getch();

system("cls");
}

cout << "Enter the Password : ";

cin >> password;

if (password == 12345) {

cout << endl;

cout << "Welcome, " << username << "!" << endl;

cout << endl;

cout << "Authorization Success!!" << endl;

cout << "Press any key to move to the admin page: ";

_getch();

mainFunctionEMP();

break;

else {

cout << "Invalid Password" << endl;

_getch();

system("cls");

loop = false;

else if (selected == '2')

system("cls");
loop = false;

cout << "\n\n\n\t\t\tEnter your First Name: ";

cin >> fname;

cout << "\n\n\t\t\tEnter your Last Name: ";

cin >> lname;

name = fname + " " + lname;

cout << "\n\n\t\t\tEnter your Address: ";

cin >> address;

cout << "\n\n\n\n\n\t\t\t\t\t\tHello, " << name << endl;

cout << "\n\t\t\t\t\t Your Delivery Address: " << address << endl;

Sleep(3000); // fake delay to show processing you can remove it

system("cls");

choice12();

else

cout << endl;

cout << "Wrong Choice entered!\n" << endl;

cout << "Press any key to try again!\n";

_getch();

system("cls");

}
}

void choice12()

vector<MenuItem> foodMenu = {

{"Burger", 5.99},

{"Pizza", 8.49},

{"Salad", 3.95},

{"Pasta", 6.75},

{"Sushi", 12.99},

{"Taco", 4.25},

{"Sandwich", 5.50},

{"Steak", 15.75},

{"Soup", 3.25},

{"Fried Chicken", 7.50},

{"Ramen", 9.25},

{"Fish and Chips", 10.99},

{"Burrito", 6.95},

{"Shawarma", 8.75},

{"Curry", 11.50},

{"Omelette", 5.25},

{"Smoothie Bowl", 4.50},

{"Waffle", 6.25},
{"Samosa", 2.99},

{"Pho", 8.25}

};

system("cls");

vector<MenuItem> drinkMenu = {

{"Mojito", 4.50},

{"Piña Colada", 5.25},

{"Moscow Mule", 4.75},

{"Bellini", 3.99},

{"Sangria", 4.25},

{"Paloma", 3.50},

{"Mimosa", 2.95},

{"Dark 'n' Stormy", 4.25},

{"Aperol Spritz", 5.50},

{"Whiskey Sour", 4.25},

{"Negroni", 5.75},

{"Old Fashioned", 6.25},

{"Sidecar", 5.99},

{"Caipirinha", 4.50},

{"Gin Rickey", 3.75},

{"White Russian", 4.99},

{"Tequila Sunrise", 3.25},

{"Blue Lagoon", 3.50},

{"Sex on the Beach", 4.25},

{"Hurricane", 5.25},

{"Lemon Drop Martini", 4.75},

{"Irish Coffee", 3.99},

{"Hot Toddy", 4.25},


{"Pisco Sour", 3.50},

{"French 75", 5.75}

};

system("cls");

vector<MenuItem> coffeeMenu = {

{"Espresso", 3.0},

{"Cappuccino", 4.5},

{"Latte", 4.0},

{"Mocha", 4.25},

{"Lemon Drop Martini", 4.75},

{"Irish Coffee", 3.99},

{"Hot Toddy", 4.25},

{"Pisco Sour", 3.50},

{"French 75", 5.75},

{"Boulevardier", 4.25},

{"Gimlet", 3.75},

{"Manhattan", 5.99},

{"Sazerac", 4.50},

{"Corpse Reviver", 4.25}

};

system("cls");

vector<MenuItem> SweetsMenu = {

{"Chocolate Cake", 4.99},

{"Vanilla Cupcake", 2.50},

{"Strawberry Cheesecake", 5.75},

{"Brownie", 3.25},

{"Macaron", 1.99},
{"Lemon Tart", 3.50},

{"Pecan Pie", 6.25},

{"Red Velvet Cookie", 2.75},

{"Churros", 3.95},

{"Caramel Flan", 4.50},

{"Fruit Salad", 3.25},

{"Chocolate Truffle", 4.75},

{"Rice Pudding", 2.99},

{"Blueberry Muffin", 2.25},

{"Coconut Macaroon", 1.75},

{"Pumpkin Pie", 5.50},

{"Banana Split", 4.25},

{"Tiramisu", 6.99},

{"Cotton Candy", 3.50},

{"Gingerbread Cookie", 2.49} };

system("cls");

vector<MenuItem> icecreamsMenu = {

{"Vanilla", 3.50},

{"Chocolate", 3.75},

{"Strawberry", 4.25},

{"Mint Chocolate Chip", 4.50},

{"Cookies and Cream", 4.99},

{"Rocky Road", 5.25},

{"Butter Pecan", 4.75},

{"Coffee", 3.95},

{"Pistachio", 4.50},

{"Salted Caramel", 4.25},

{"Neapolitan", 5.50},
{"Cookie Dough", 4.25},

{"Raspberry Ripple", 3.99},

{"Matcha Green Tea", 4.75},

{"Toasted Marshmallow", 4.50},

{"Cherry Garcia", 5.75},

{"Maple Walnut", 4.25},

{"Bubblegum", 3.50},

{"Tiramisu", 5.99},

{"Red Velvet", 4.25} };

system("cls");

vector<MenuItem> fishMenu = {

{"Salmon",4.3},

{"Tuna",8},

{"Cod",4.2},

{"Trout",2.3},

{"Halibut",3},

{"Sardines",5.5},

{"Mahi Mahi",6},

{"Barramundi",7.1},

{"Snapper",2.2},

{"Grouper",1.2},

{"Haddock",2.2},

{"Mackerel",3.8},

{"Catfish",5.5},

{"Sole",5.6},

{"Flounder",6.6},

{"Perch",7.7},
{"Rainbow Trout",10},

{"Anchovies",4.5},

{"Swordfish",3.3},

{"Bluefish",2.2}

};

system("cls");

int menuChoice;

while (true) {

cout << "\n\t\t\t\t\t\t*_________________________*";

cout << "\n\t\t\t\t\t\t| |";

cout << "\n\t\t\t\t\t\t| AB Restaurant MENU |";

cout << "\n\t\t\t\t\t\t|_________________________|" << endl;

cout << "\n\t\t\t\t\t\t";

cout << "\n\n\t\t\t1. Food";

cout << "\n\n\t\t\t2. Drinks";

cout << "\n\n\t\t\t3. Coffee";

cout << "\n\n\t\t\t4. Sweets";

cout << "\n\n\t\t\t5. Ice creams";

cout << "\n\n\t\t\t6. Fish";

cout << "\n\n\t\t\t7. Exit";

cout << "\n\n\n\n\t\t\tPlease choose a menu to order from: ";

cin >> menuChoice;

system("cls");
switch (menuChoice) {

case 1:

placeOrder(foodMenu);

break;

case 2:

placeOrder(drinkMenu);

break;

case 3:

placeOrder(coffeeMenu);

break;

case 4:

placeOrder(SweetsMenu);

break;

case 5:

placeOrder(icecreamsMenu);

break;

case 6:

placeOrder(fishMenu);

break;

case 7:

cout << "\n\n\t\t\t\tThank you for visiting AB Restaurants. Goodbye!";

exit(0);

default:

cout << "\n\n\t\t\tInvalid choice. Please try again.";

Sleep(2000); // fake delay to show processing!!

system("cls");

break;
}

void mainFunctionEMP() {

struct Employee {

int id;

string name;

string position;

double salary;

};

struct FoodItem {

int id;

string name;

double price;

};

vector<Employee> employees;

vector<FoodItem> foodItems;

int choice;

do {
system("cls");

cout << "\n--- Restaurant Employee Portal ---\n";

cout << "1. Add New Employee\n";

cout << "2. Check Employee Records\n";

cout << "3. Add New Food Item\n";

cout << "4. Check Food Item Records\n";

cout << "5. Exit\n";

cout << "Enter your choice: ";

cin >> choice;

if (choice == 1) {

Employee emp;

cout << "Enter Employee ID: ";

cin >> emp.id;

cin.ignore(); // Clear newline from buffer

cout << "Enter Employee Name: ";

getline(cin, emp.name);

cout << "Enter Position: ";

getline(cin, emp.position);

cout << "Enter Salary: ";

cin >> emp.salary;

employees.push_back(emp);

ofstream file("employees.txt", ios::app);

if (file.is_open()) {

file << emp.id << "," << emp.name << "," << emp.position << "," << emp.salary << endl;

file.close();

cout << "Employee added and saved to file.\n";


}

else {

cout << "Error saving employee to file.\n";

else if (choice == 2) {

if (employees.empty()) {

cout << "No employees found.\n";

else {

cout << "Employee Records:\n";

for (const auto& emp : employees) {

cout << "ID: " << emp.id << ", Name: " << emp.name

<< ", Position: " << emp.position

<< ", Salary: " << emp.salary << endl;

else if (choice == 3) {

FoodItem item;

cout << "Enter Food Item ID: ";

cin >> item.id;

cin.ignore(); // Clear newline from buffer

cout << "Enter Food Item Name: ";

getline(cin, item.name);

cout << "Enter Price: ";

cin >> item.price;

foodItems.push_back(item);
ofstream file("food_items.txt", ios::app);

if (file.is_open()) {

file << item.id << "," << item.name << "," << item.price << endl;

file.close();

cout << "Food item added and saved to file.\n";

else {

cout << "Error saving food item to file.\n";

else if (choice == 4) {

if (foodItems.empty()) {

cout << "No food items found.\n";

else {

cout << "Food Items:\n";

for (const auto& item : foodItems) {

cout << "ID: " << item.id << ", Name: " << item.name

<< ", Price: $" << item.price << endl;

else if (choice == 5) {

cout << "Exiting portal. Goodbye!\n";

else {

cout << "Invalid choice. Please try again.\n";

}
} while (choice != 5);

You might also like