Project Report. Data Structure of Restuarent Order System in c++
Project Report. Data Structure of Restuarent Order System in c++
Title:
Data Structure of restaurant order system in c++
Table of Contents:
1. Introduction
2. Problem Statement & Objectives
3. Codes
4. Tools and Technologies Used
5. Program Design and Logic
6. Data Structures Used
7. Code Explanation (Module-wise)
8. Testing and Output Screenshots
9. Advantages and Limitations
10. Future Enhancements
11. Conclusion
1. Introduction:
The Restaurant Order System is a console-based application developed in C++
that simulates the core functionalities of a food ordering system in a small
restaurant. The aim of this project is to demonstrate basic and intermediate
programming concepts using real-world scenarios. This includes working with
user-defined data structures, arrays, control flow statements, string
manipulation, and object-oriented programming through classes. The system
allows customers to view a menu, select food items, specify quantities, and
receive a detailed receipt at the end of the transaction.
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
struct FoodItem {
string name;
double price;
int quantity;
};
class Restaurant {
public:
FoodItem menu[5] = {
{"Burger", 5.99, 10}, {"Pizza", 8.99, 5}, {"Pasta", 7.49, 8},
{"Salad", 4.99, 20}, {"Soda", 1.99, 50}
};
void viewMenu() {
cout << "\nMenu:\n";
for (int i = 0; i < 5; ++i)
cout << menu[i].name << " - $" << menu[i].price << " (" << menu[i].quantity << "
available)\n";
}
void takeOrder() {
string name;
cout << "\nEnter customer name: ";
cin.ignore();
getline(cin, name);
double total = 0;
while (true) {
int choice, qty;
cout << "\nChoose item (1-5) or 0 to finish: ";
cin >> choice;
if (choice == 0) break;
if (choice < 1 || choice > 5) {
cout << "Invalid item, try again.\n";
continue;
}
cout << "Enter quantity: ";
cin >> qty;
if (menu[choice - 1].quantity < qty) {
cout << "Not enough stock.\n";
continue;
}
menu[choice - 1].quantity -= qty;
total += menu[choice - 1].price * qty;
}
cout << "\nReceipt for " << name << "\nTotal: $" << fixed << setprecision(2) << total
<< endl;
}
};
int main() {
Restaurant restaurant;
while (true) {
cout << "\n***********\n";
cout << " Restaurant Order System\n";
cout << "***********\n";
cout << "1. View Menu\n";
cout << "2. Take Order\n";
cout << "3. Exit\n";
cout << "Please enter your choice (1-3): ";
int choice;
cin >> choice;
if (choice == 1) restaurant.viewMenu();
else if (choice == 2) restaurant.takeOrder();
else if (choice == 3) break;
else cout << "Invalid choice. Try again.\n";
}
return 0;
}
struct FoodItem {
string name;
double price;
int quantity;
};
Input: 7 (Invalid)
Output:
Input: 0
Output:
Advantages:
Limitations:
CS-201L
Data Structure and Algorithms
Project Report
Submitted to:
Sir. Saad Saud Ali Shah
Submitted By:
Anwar ul haq UW-23T-EE-BSc-009
Adeel Baig UW-24T-EE-BSc-001
Date of submission:
June, 17, 2025