Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- void Menu();
- void seatAvailability();
- void seatBooking();
- void freeSeat();
- void grossProfit();
- void changeOption();
- int ticket_no,type,free_seats,f_ticket, amount, a_count;
- const int half = 5000;
- const int full = 10000;
- int available_seats =20;
- int tickets[20][2];
- using namespace std;
- int main()
- {
- Menu();
- return 0;
- }
- void Menu(){
- //Menu
- cout <<"Movie Theatre System" << endl
- <<" || WELCOME ||" << endl
- <<" ************************* " << endl << endl
- <<" MAIN MENU: " << endl
- <<"1--> View seats" << endl
- <<"2--> Book seats" << endl
- <<"3--> Free up seats" << endl
- <<"4--> Gross Profit" << endl
- <<"5--> Change Option" << endl
- <<"6--> Quit" << endl;
- //Selection
- int option;
- do{
- cout << endl << "Please select an option: ";
- cin >> option;
- switch (option)
- {
- case 1:
- seatAvailability();
- break;
- case 2:
- seatBooking();
- break;
- case 3:
- freeSeat();
- break;
- case 4:
- grossProfit();
- break;
- case 5:
- changeOption();
- break;
- case 6:
- cout << "Out of range" << endl;
- break;
- default:
- cout <<"Please choose a valid option:" << endl
- << "=============================" << endl;
- cin.ignore();
- }
- Menu();
- }
- while (option != 6);
- }
- void seatAvailability(){
- cout <<"Available seats " << available_seats << endl;
- }
- void seatBooking(){
- cout <<"Choose viewing session type "<< endl
- <<"\1-->Full-Marathon" << endl
- << endl <<"2-->Half-Marathon: ";
- cin >> type;
- //Pay
- if(type==1){
- amount = amount + full;
- //Update seat number
- available_seats = available_seats - 1;
- a_count = a_count+1;
- tickets[a_count][0] = a_count;
- tickets [a_count][1] = 1;
- cout << "Your ticket number is " << tickets[a_count][0] << " and viewing type is Full-Marathon" << endl;
- }
- else{
- amount = amount + half;
- //Update seat number
- available_seats = available_seats - 1;
- a_count = a_count+1;
- tickets[a_count][0] = a_count;
- tickets [a_count][1] = 2;
- cout << "Your ticket number is " << tickets[a_count][0] << " and viewing type is Half-Marathon" << endl;
- }
- Menu();
- }
- void freeSeat(){
- cout << Freed seats " << f_ticket<< endl;
- cout << endl << "Enter ticket number of seat to free";
- cin >>f_ticket;
- tickets[f_ticket][0] = 0;
- tickets[f_ticket][1] = 0;
- cout << "Seat for ticket " << f_ticket << " is freed" << endl;
- }
- void grossProfit(){
- cout <<"Gross profit is " << amount << endl;
- }
- void changeOption(){
- cout << endl <<"Enter ticket number: ";
- cin>>ticket_no;
- if(tickets[ticket_no][1] == 1){
- cout <<"Viewing type is Full-Marathon" <<endl;
- tickets[ticket_no][1] = 2;
- amount = amount - half;
- cout <<"New viewing type for ticket " << tickets[ticket_no][0] <<" is Half-Marathon" <<endl;
- }
- else{
- cout <<"Viewing type is Half-Marathon" <<endl;
- tickets[ticket_no][1] = 1;
- amount = amount + half;
- cout <<"New viewing type for ticket " << tickets[ticket_no][0] <<" is Full-Marathon" <<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement