Restaurant
Restaurant
#include <string>
#include <iomanip>
string foodMenuNames[MAX_MENU_ITEMS];
double foodMenuPrices[MAX_MENU_ITEMS];
int foodCount = 0;
struct OrderItem {
string name;
double price;
OrderItem* next;
};
struct OrderQueue {
OrderItem* front;
OrderItem* rear;
int orderIdCounter;
};
return -1;
void sortMenuByPriceDesc() {
void insertFoodItem() {
return;
cin.ignore();
cout << "Enter the name of the food item: ";
getline(cin, foodMenuNames[foodCount]);
if (findFoodIndex(foodMenuNames[foodCount]) != -1) {
return;
cout << "Enter the price of " << foodMenuNames[foodCount] << ": ";
foodCount++;
sortMenuByPriceDesc();
void displayFoodItems() {
if (foodCount == 0) {
return;
cout.width(25);
cout.width(7);
void deleteFoodItem() {
cin.ignore();
string foodName;
getline(cin, foodName);
if (index == -1) {
return;
foodCount--;
cout << "Food item deleted: " << foodName << endl;
if (orders.rear) {
orders.rear->next = newOrder;
} else {
orders.front = newOrder;
orders.rear = newOrder;
<< ", Food = " << foodName << " (Birr_" << price << ")\n";
orders.orderIdCounter++;
void dequeue() {
if (!orders.front) {
orders.front = orders.front->next;
delete temp;
void displayOrders() {
if (!orders.front) {
return;
int orderId = 1;
while (temp) {
temp = temp->next;
}
}
void insertOrder() {
cin.ignore();
string foodName;
getline(cin, foodName);
if (index != -1) {
enqueue(foodMenuNames[index], foodMenuPrices[index]);
} else {
void cleanUp() {
while (orders.front) {
orders.front = orders.front->next;
delete temp;
int main() {
foodMenuNames[foodCount] = "Shekla Tibs(ሸክላ ጥብስ)"; foodMenuPrices[foodCount++] = 580;
sortMenuByPriceDesc();
int choice;
char cont;
do {
switch (choice) {
case 1:
do {
insertFoodItem();
break;
case 2:
displayFoodItems();
break;
case 3:
do {
insertOrder();
break;
case 4:
displayOrders();
break;
case 5:
dequeue();
break;
case 6:
deleteFoodItem();
break;
case 7:
cleanUp();
break;
default:
return 0;