Expand|Select|Wrap|Line Numbers
- #include <iostream>
- #include <stdio.h>
- #include <malloc.h>
- #include <string.h>
- #include <stdlib.h>
- #include <ctype.h>
- #define delivery =5
- using namespace std;
- int choice1,choice2,n,price,pay,i,pm;
- char username[20],set;
- void loadingbar();
- void autoCreateMenu();
- void foodList();
- void bill();
- do
- {
- system("cls");
- printf("\n\t\t\t\t\t============================================\n\t\t\t\t\t\t\tL O G I N\n\t\t\t\t\t============================================\n\n\t\t\t\t\t\t\t1. User\n\n\t\t\t\t\t\t\t2. Admin\n\t\t\t\t\t\t\n\n\n\t\t\t\t\t\tEnter choice: ");
- scanf("%d",&choice1);
- switch(choice1)
- {
- case 2: system("cls");
- do{
- printf("\n\t\t\t\t\t============================================\n\t\t\t\t\t\t A D M I N P A N E L\n\t\t\t\t\t============================================\n\n\t\t\t\t\t\t1. Edit Menu\n\n\t\t\t\t\t\t2. Orders\n\n\t\t\t\t\t\t3. Back\n\n\n\t\t\t\t\t\tEnter choice: ");
- scanf("%d",&choice2);
- switch(choice2)
- {
- case 1:
- do
- {
- system("cls");
- printf("\n\t\t\t\t\t============================================\n\t\t\t\t\t\t\tE D I T M E N U\n\t\t\t\t\t============================================\n\n\t\t\t\t\t\t1. Add Items\n\n\t\t\t\t\t\t2. Edit Item\n\n\t\t\t\t\t\t3. View Menu\n\n\t\t\t\t\t\t4. Back\n\n\t\t\t\t\t\tEnter choice: ");
- scanf("%d", &choice2);
- switch(choice2)
- {
- case 1:
- system("cls");
- createMenuItem();
- getch();
- break;
- case 2:
- editItem();
- break;
- case 3:
- system("cls");
- displayMenu();
- printf("\n\n\t\t\t\t\t Press any button to return to previous screen");
- getch();
- break;
- }
- }while(choice2!=4);
- system("cls");
- break;
- case 2:
- do
- {
- system("cls");
- printf("\n\t\t\t\t\t============================================\n\t\t\t\t\t\t\tO R D E R S\n\t\t\t\t\t============================================\n\n\t\t\t\t\t\t1. Serve order\n\n\t\t\t\t\t\t2. View Orders\n\n\t\t\t\t\t\t3. Back\n\n\t\t\t\t\t\tEnter choice: ");
- scanf("%d", &choice2);
- switch(choice2)
- {
- case 1:
- system("cls");
- dequeueOrder();
- getch();
- break;
- case 2:
- system("cls");
- displayOrder();
- getch();
- break;
- }
- }while(choice2!=3);
- break;
- }
- }while(choice2!=3);
- break;
- case 1: system("cls");
- printf("\n\n\n\n\n\n\t\t\t\t\t\tEnter username: ");
- ccolor(10);
- fflush(stdin);
- gets(username);
- ccolor(15);
- do
- {
- system("cls");
- printf("\n\t\t\t\t\t============================================\n\t\t\t\t\t\tW E L C O M E , ");
- stringify(username);
- printf("\n\t\t\t\t\t============================================\n\n\t\t\t\t\t\t1. Order\n\n\t\t\t\t\t\t2. View Cart\n\n\t\t\t\t\t\t3. Proceed to Checkout\n\n\t\t\t\t\t\t0. <- Back\n\n\n\t\t\t\t\t\tEnter choice:");
- scanf("%d",&choice2);
- switch(choice2)
- {
- case 1: pushFoodItem(username);
- foodList();
- break;
- case 2: displayCart(username);
- printf("\n\n\t\t\t\t\t Press any button to return to previous screen");
- getch();
- break;
- case 3: enqueueOrder(username);
- displayCart(username);
- bill();
- ccolor(47);
- printf("\n\n\t\t\t\t\t\t Order placed successfully ");
- ccolor(15);
- printf("\n\n\t\t\t\t\t Press any button to return to main screen");
- getch();
- Sleep(50);
- break;
- }
- }while (choice2!=0 && choice2!=3);
- break;
- }
- }while(choice1!=4);
- }
- void foodList()
- {
- cout<<"*************************************************MENU*********************************************************"<<endl;
- cout<<"* *"<<endl;
- cout<<"* SET A SET B SET C *"<<endl;
- cout<<"* Grilled Chicken Chop Chicken Curry with Rice Sweet and Sour Chicken *"<<endl;
- cout<<"* Prawn Sweet and sour prawn Prawn with vegetables *"<<endl;
- cout<<"* Cheese Cake Fruit Cake Mango Cake *"<<endl;
- cout<<"* Sprite Apple Juice Mango Juice *"<<endl;
- cout<<"* RM 35 RM 40 RM 45 *"<<endl;
- cout<<"* *"<<endl;
- cout<<"* SET D SET E *"<<endl;
- cout<<"* Fish and chips Grilled Lamb Chop *"<<endl;
- cout<<"* Ice-cream Custard Pies *"<<endl;
- cout<<"* Hot Choco Iced Green Tea *"<<endl;
- cout<<"* RM 30 RM 30 *"<<endl;
- cout<<"****************************************************************************************************************"<<endl;
- }
- void bill();
- {
- if(set=='a'||set=='A')
- price=35
- cout<<"Total= RM 35";
- else if(set=='b'||set=='B')
- cout<<"Total= RM 40";
- else if(set=='c'||set=='C')
- cout<<"Total= RM 45";
- else if(set=='d'||set=='D')
- cout<<"Total= RM 30";
- else if(set=='e'||set=='E')
- cout<<"Total= RM 30";
- else
- cout<<"SORRY! You enter the wrong item. Please try again.";
- cin>>set;
- cout<<"Quantity: "<<i<<endl;
- cout<<"Select the payment method: "<<endl;
- cout<<" a. Membership"<<endl;
- cout<<" b. Cash"<<endl;
- cin>>pm;
- if(pm=='a')
- {
- cout<<"Account Balance: RM 100"<<endl;
- pay=balance-(5+(i*price));
- }
- }
- /*//******************************************************************************************************************************************
- // wait function defenation which use for exit function
- //*******************************************************************************************************************************************
- void wait ( int seconds )
- //this function contains void type & returns nothing
- {
- clock_t waitend;
- waitend = clock () + seconds * CLOCKS_PER_SEC ;
- while (clock() < waitend) {}
- }*/