Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<stdlib.h>
- #include<fstream>
- #include<string>
- #include<conio.h>
- #include<windows.h>
- using namespace std;
- class Restaurent
- {
- int Price,Amount;
- string Name;
- public:
- void set_Val(string name,int price,int quantity)
- {
- Name=name;
- Price=price;
- Amount=quantity;
- }
- void showmenu(int i)
- {
- cout<<"\t\t\t#"<<i<<endl;
- cout<<"\t\t\tName: "<<Name<<endl;
- cout<<"\t\t\tPrice: "<<Price<<endl;
- cout<<"\t\t\tAmount: "<<Amount<<endl<<endl;
- }
- void showbill(int j,int Q)
- {
- cout<<endl;
- cout<<"\t\t\tYou have selected #"<<j<<endl;
- cout<<"\t\t\tName: "<<Name<<endl;
- cout<<"\t\t\tQuantity: "<<Q<<endl;
- cout<<"\t\t\tTotal bill: "<<Q*Price<<endl;
- cout<<"\t\t\tThank you!"<<endl;
- system("color 2");
- getch();
- }
- };
- int main()
- {
- //...............OWNER PART................
- Restaurent management[50];
- ofstream RestaurentM;
- int items1,price,quantity,i;
- string name;
- cout<<"\n\n\n\t\t\t\t================================================="<<endl;
- cout<<"\t\t\t\t\t| RESTAURENT MANAGEMENT SYSTEM |"<<endl;
- cout<<"\t\t\t\t=================================================\n"<<endl;
- cout<<"\t\t\t1. Add new items\n\t\t\t2. skip\n\t\t\t3.Exit\n";
- int choice2;
- cout<<"\t\t\tSelect: ";
- cin>>choice2;
- if(choice2==1)
- {
- cout<<"\t\t\tHow many items:";
- cin>>items1;
- //..........TAKING MENU FROM THE OWNER........
- for(i=1; i<=items1; i++)
- {
- cout<<"\t\t\t#"<<i<<endl;
- cout<<"\t\t\tName: ";
- cin>>name;
- cout<<"\t\t\tPrice: ";
- cin>>price;
- cout<<"\t\t\tAmount: ";
- cin>>quantity;
- management[i].set_Val(name,price,quantity);
- RestaurentM.open("Restaurent Management copy.txt",ios::app|ios::out);
- RestaurentM<<"\t\t\t#"<<i<<"\n\t\t\tName : "<<name<<"\n\t\t\tPrice: "<<price<<"\n\t\t\tamount: "<<quantity<<endl;
- RestaurentM.close();
- }
- }
- else if(choice2==2)
- goto wlcmsg;
- else if(choice2==3)
- {
- exit(0);
- }
- system("cls");
- //.................CUSTOMER PART..................
- wlcmsg:
- system("cls");
- cout<<"\n\n\n\t\t\t\t| WELCOME TO RESTAURENT |"<<endl;
- cout<<"\t\t\t=======================================\n"<<endl;
- cout<<"\t\t\t1.See all items\n\t\t\t2.select"<<endl;
- //.....IF CUSTOMER WANT SEE ALL ITEMS......
- int select;
- cout<<"\t\t\tchoose: ";
- cin>>select;
- if(select==1)
- {
- int selected_item,Number_of_Plate;
- //......IF THE OWNER SELECT 'SKIP' OPTION, THEN THIS PART WILL BE EXECUTED....
- /* if(choice1==2)
- {
- for(i=1; i<=items1; i++)
- {
- management[i].showmenu(i);
- }
- cout<<endl;
- }
- //....IF THE OWNER WANT TO SHOW MORE ADDED ITEMS,THEN THIS PART WILL BE EXECUTED....
- else if(choice1==1)
- {
- for(i=1; i<=items1+items2; i++)
- {
- management[i].showmenu(i);
- }
- cout<<endl;
- }
- */
- ifstream RestaurentM;
- string line_by_line;
- RestaurentM.open("Restaurent Management copy.txt",ios::in);
- if(RestaurentM.is_open())
- {
- while(getline(RestaurentM,line_by_line))
- {
- cout<<line_by_line<<endl;
- }
- RestaurentM.close();
- }
- else
- {
- cout<<"\t\t\tFile is not found\n";
- Sleep(1000);
- goto wlcmsg;
- }
- RestaurentM.close();
- S:
- cout<<"\t\t\tselect items :";
- cin>>selected_item;
- if(selected_item>items1)
- {
- cout<<"\t\t\tInvalid choice!.\nPlease again ";
- goto S;
- }
- q:
- cout<<"\t\t\tquantity: ";
- cin>>Number_of_Plate;
- if(Number_of_Plate>quantity)
- {
- cout<<"\t\t\tSorry, we have "<<quantity<<" items available only.Please select not more than quantity"<<quantity<<endl;
- goto q;
- }
- else
- {
- management[selected_item].showbill(selected_item,Number_of_Plate);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement