I am troubled by my very long code for a movie reservation program. A friend of mine told me that I can shorten my very long code using functions. What made my code very long is the switch statement that I used which is composed of 200 cases. Sorry because I'm just starting to learn c++ that's why I just use what is more basic. Here is my code:

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{

     int movie; double ticketprice(2.35);int actors;
     int information; int wallstreet; int seatnumber; char name; int cinemanumber;
     string s1 = "1", s2 = "2", s3 = "3" , s4 = "4", s5 = "5", s6 = "6", s7 = "7", s8 = "8"  , s9 = "9" , s10 = "10",  s11 = "11", s12 = "12", s13 = "13" , s14 = "14", s15 = "15", s16 = "16", s17 = "17", s18 = "18"  , s19 = "19" , s20 = "20",
          s21 = "21", s22 = "22", s23 = "23" , s24 = "24", s25 = "25", s26 = "26", s27 = "27", s28 = "28"  , s29 = "29" , s30 = "30", 
          s31 = "31", s32 = "32", s33 = "33" , s34 = "34", s35 = "35", s36 = "36", s37 = "37", s38 = "38"  , s39 = "39" , s40 = "40",
          s41 = "41", s42 = "42", s43 = "43" , s44 = "44", s45 = "45", s46 = "46", s47 = "47", s48 = "48"  , s49 = "49" , s50 = "50",
          s51 = "51", s52 = "52", s53 = "53" , s54 = "54", s55 = "55", s56 = "56", s57 = "57", s58 = "58"  , s59 = "59" , s60 = "60",
          s61 = "61", s62 = "62", s63 = "63" , s64 = "64", s65 = "65", s66 = "66", s67 = "67", s68 = "68"  , s69 = "69" , s70 = "70",
          s71 = "71", s72 = "72", s73 = "73" , s74 = "74", s75 = "75", s76 = "76", s77 = "77", s78 = "78"  , s79 = "79" , s80 = "80",
          s81 = "81", s82 = "82", s83 = "83" , s84 = "84", s85 = "85", s86 = "86", s87 = "87", s88 = "88"  , s89 = "89" , s90 = "90",
          s91 = "91", s92 = "92", s93 = "93" , s94 = "94", s95 = "95", s96 = "96", s97 = "97", s98 = "98"  , s99 = "99" , s100 = "100",
          s101 = "101", s102 = "102", s103 = "103" , s104 = "104", s105 = "105", s106 = "106", s107 = "107", s108 = "108"  , s109 = "109" , s110 = "110",  s111 = "111", s112 = "112", s113 = "113" , s114 = "114", s115 = "115", s116 = "116", s117 = "117", s118 = "118"  , s119 = "119" , s120 = "120",
          s121 = "121", s122 = "122", s123 = "123" , s124 = "124", s125 = "125", s126 = "126", s127 = "127", s128 = "128"  , s129 = "129" , s130 = "130", 
          s131 = "131", s132 = "132", s133 = "133" , s134 = "134", s135 = "135", s136 = "136", s137 = "137", s138 = "138"  , s139 = "139" , s140 = "140",
          s141 = "141", s142 = "142", s143 = "143" , s144 = "144", s145 = "145", s146 = "146", s147 = "147", s148 = "148"  , s149 = "149" , s150 = "150",
          s151 = "151", s152 = "152", s153 = "153" , s154 = "154", s155 = "155", s156 = "156", s157 = "157", s158 = "158"  , s159 = "159" , s160 = "160",
          s161 = "161", s162 = "162", s163 = "163" , s164 = "164", s165 = "165", s166 = "166", s167 = "167", s168 = "168"  , s169 = "169" , s170 = "170",
          s171 = "171", s172 = "172", s173 = "173" , s174 = "174", s175 = "175", s176 = "176", s177 = "177", s178 = "178"  , s179 = "179" , s180 = "180",
          s181 = "181", s182 = "182", s183 = "183" , s184 = "184", s185 = "185", s186 = "186", s187 = "187", s188 = "188"  , s189 = "189" , s190 = "190",
          s191 = "191", s192 = "192", s193 = "193" , s194 = "194", s195 = "195", s196 = "196", s197 = "197", s198 = "198"  , s199 = "199" , s200 = "200";
         
     string reserved;
     char ans;\
     double total;
     
     int p;
     
     cout << endl;
     cout << endl;
     cout << "******************************************************************************** \n";
     cout << "**************************   WELCOME TO AT1 CINEMAS  *************************** \n"
          << "******************************************************************************** \n"
          << "\n"
          << "\n"
          << "PLEASE SELECT A MOVIE BELOW: \n" 
          << "\n"
          << "\n" 
          << "1. WALLSTREET >>> SYNOPSIS: To take down a merciless finance executive,"; 
          cout<< "         a young trader agrees to a disgraced Wall street legend's proposal in exchange"; 
          cout << " for the man to be reunited with his daughter, the trader's fiancée. \n" 
          << "\n"
          << "Stars: Shia LaBeouf, Michael Douglas and Carey Mulligan \n"
          << "\n"
          << "2. THE SOCIAL NETWORK >>> SYNOPSIS: A chronicle of the founding of Facebook,"; 
         cout <<  "    the social-networking Web site.\n"
          << "\n"
          << "Stars: Jesse Eisenberg, Andrew Garfield and Justin Timberlake \n"
          << "\n"
          << "3. TAKERS >>> SYNOPSIS: A group of bank robbers find their multi-million dollar plan"; 
    cout  << " interrupted by a hard-boiled detective.\n"
          << "\n"
          << "Stars: Chris Brown, Hayden Christensen and Matt Dillon \n"
          << "\n";
          
     cout << endl;
     
     cout << "Type here only the number of your choice: ";
     cin >> movie;
     
     cout << endl;
     
     
     if (movie == 1)
     cout << "You have selected the movie: Wallstreet" <<endl;
     else if (movie == 2)
     cout << "You have selected the movie: The Social Network" << endl;
     else if (movie == 3)
     cout << "You have selected the movie: Takers" << endl;
     
     cout << endl;
     
     cout << "Choose your seatnumber below \n";
     cout << endl;
     cout << "\tCinema 1"<<endl;
     cout << "\tCinema 2"<<endl;
     cout << "\tCinema 3"<<endl;
     cout <<endl;
     
     cout << "Type here your cinema number: ";
     cin >> cinemanumber;
     
     cout << "********************************************************************************" << endl;
     cout << endl;
     
     {
     do
     {
         cout << " [============================================================================]" <<endl;
         cout << " |                               CINEMA   SCREEN                              |" <<endl;
         cout << " [============================================================================]" <<endl;
         
         cout <<endl;
                          
     
      cout <<"     "<< "[" <<s1<< "]" << "[" <<s2<< "]" << "[" <<s3<< "]" << "[" <<s4<< "]" << "[" <<s5<< "]" << "[" <<s6<< "]" << "[" <<s7<< "]" << "[" <<s8<< "]"  << "[" <<s9<< "]" << "[" <<s10<< "]" << "[" <<s11<< "]" << "[" <<s12<< "]" << "[" <<s13<< "]" << "[" <<s14<< "]" << "[" <<s15<< "]" << "[" <<s16<< "]" << "[" <<s17<< "]" << "[" <<s18<< "]"  << "[" <<s19<< "]" << "[" <<s20<< "]"<<endl<<endl 
           << "[" <<s21<< "]" << "[" <<s22<< "]" << "[" <<s23<< "]" << "[" <<s24<< "]" << "[" <<s25<< "]" << "[" <<s26<< "]" << "[" <<s27<< "]" << "[" <<s28<< "]"  << "[" <<s29<< "]" << "[" <<s30<< "]" << "[" <<s31<< "]" << "[" <<s32<< "]" << "[" <<s33<< "]" << "[" <<s34<< "]" << "[" <<s35<< "]" << "[" <<s36<< "]" << "[" <<s37<< "]" << "[" <<s38<< "]"  << "[" <<s39<< "]" << "[" <<s40<< "]"<<endl
           << "[" <<s41<< "]" << "[" <<s42<< "]" << "[" <<s43<< "]" << "[" <<s44<< "]" << "[" <<s45<< "]" << "[" <<s46<< "]" << "[" <<s47<< "]" << "[" <<s48<< "]"  << "[" <<s49<< "]" << "[" <<s50<< "]" << "[" <<s51<< "]" << "[" <<s52<< "]" << "[" <<s53<< "]" << "[" <<s54<< "]" << "[" <<s55<< "]" << "[" <<s56<< "]" << "[" <<s57<< "]" << "[" <<s58<< "]"  << "[" <<s59<< "]" << "[" <<s60<< "]"<<endl 
           << "[" <<s61<< "]" << "[" <<s62<< "]" << "[" <<s63<< "]" << "[" <<s64<< "]" << "[" <<s65<< "]" << "[" <<s66<< "]" << "[" <<s67<< "]" << "[" <<s68<< "]"  << "[" <<s69<< "]" << "[" <<s70<< "]" << "[" <<s71<< "]" << "[" <<s72<< "]" << "[" <<s73<< "]" << "[" <<s74<< "]" << "[" <<s75<< "]" << "[" <<s76<< "]" << "[" <<s77<< "]" << "[" <<s78<< "]"  << "[" <<s79<< "]" << "[" <<s80<< "]"<<endl
           << "[" <<s81<< "]" << "[" <<s82<< "]" << "[" <<s83<< "]" << "[" <<s84<< "]" << "[" <<s85<< "]" << "[" <<s86<< "]" << "[" <<s87<< "]" << "[" <<s88<< "]"  << "[" <<s89<< "]" << "[" <<s90<< "]" << "[" <<s91<< "]" << "[" <<s92<< "]" << "[" <<s93<< "]" << "[" <<s94<< "]" << "[" <<s95<< "]" << "[" <<s96<< "]" << "[" <<s97<< "]" << "[" <<s98<< "]"  << "[" <<s99<< "]" << "[" <<s100<< "]"<<endl 
           << "[" <<s101<< "]" << "[" <<s102<< "]" << "[" <<s103<< "]" << "[" <<s104<< "]" << "[" <<s105<< "]" << "[" <<s106<< "]" << "[" <<s107<< "]" << "[" <<s108<< "]"  << "[" <<s109<< "]" << "[" <<s110<< "]" << "[" <<s111<< "]" << "[" <<s112<< "]" << "[" <<s113<< "]" << "[" <<s114<< "]" << "[" <<s115<< "]" << "[" <<s116<< "]"<<endl << "[" <<s117<< "]" << "[" <<s118<< "]"  << "[" <<s119<< "]" << "[" <<s120<< "]" << "[" <<s121<< "]" << "[" <<s122<< "]" << "[" <<s123<< "]" << "[" <<s124<< "]" << "[" <<s125<< "]" << "[" <<s126<< "]" << "[" <<s127<< "]" << "[" <<s128<< "]"  << "[" <<s129<< "]" << "[" <<s130<< "]" << "[" <<s131<< "]" << "[" <<s132<< "]" <<endl << "[" <<s133<< "]" << "[" <<s134<< "]" << "[" <<s135<< "]" << "[" <<s136<< "]" << "[" <<s137<< "]" << "[" <<s138<< "]"  << "[" <<s139<< "]" << "[" <<s140<< "]"<< "[" <<s141<< "]" << "[" <<s142<< "]" << "[" <<s143<< "]" << "[" <<s144<< "]" << "[" <<s145<< "]" << "[" <<s146<< "]" << "[" <<s147<< "]" << "[" <<s148<< "]" <<endl << "[" <<s149<< "]" << "[" <<s150<< "]" << "[" <<s151<< "]" << "[" <<s152<< "]" << "[" <<s153<< "]" << "[" <<s154<< "]" << "[" <<s155<< "]" << "[" <<s156<< "]"<< "[" <<s157<< "]" << "[" <<s158<< "]"  << "[" <<s159<< "]" << "[" <<s160<< "]"<< "[" <<s161<< "]" << "[" <<s162<< "]" << "[" <<s163<< "]" << "[" <<s164<< "]" <<endl<< "[" <<s165<< "]" << "[" <<s166<< "]" << "[" <<s167<< "]" << "[" <<s168<< "]"  << "[" <<s169<< "]" << "[" <<s170<< "]" << "[" <<s171<< "]" << "[" <<s172<< "]" << "[" <<s173<< "]" << "[" <<s174<< "]" << "[" <<s175<< "]" << "[" <<s176<< "]"<< "[" <<s177<< "]" << "[" <<s178<< "]"  << "[" <<s179<< "]" << "[" <<s180<< "]"<<endl<< "[" <<s181<< "]" << "[" <<s182<< "]" << "[" <<s183<< "]" << "[" <<s184<< "]" << "[" <<s185<< "]" << "[" <<s186<< "]" << "[" <<s187<< "]" << "[" <<s188<< "]"  << "[" <<s189<< "]" << "[" <<s190<< "]" << "[" <<s191<< "]" << "[" <<s192<< "]" << "[" <<s193<< "]" << "[" <<s194<< "]" << "[" <<s195<< "]" << "[" <<s196<< "]" <<endl<< "                              " << "[" <<s197<< "]" << "[" <<s198<< "]"  << "[" <<s199<< "]" << "[" <<s200<< "]"<<endl<<endl;
           
      cout << "Type your seat number here: ";
      cin >> seatnumber;
      
      cout << endl;
      
      switch (seatnumber)
      {
       case 1:
           if (seatnumber == 1)
             {
                          if (s1 == "X")
                          cout << "Seat no. 1 is already reserved, please choose another seat.\n";
                          else 
                          total+=ticketprice;
             } 
          
           s1 ="X";
           break;
           
        case 2:
           if (seatnumber == 2)
           
                          if  (s2 == "X")
                          cout << "Seat no. 2 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s2 ="X";
           break;   
           
        case 3:
           if (seatnumber == 3)
           {
                          if  (s3 == "X")
                          cout << "Seat no.3 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s3 ="X";
           break;
            case 4:
           if (seatnumber == 4)
           
                          if  (s4 == "X")
                          cout << "Seat no. 4 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s4 ="X";
           break;   
           
        case 5:
           if (seatnumber == 5)
           {
                          if  (s5 == "X")
                          cout << "Seat no.5 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s5 ="X";
           break;
            case 6:
           if (seatnumber == 6)
           
                          if  (s6 == "X")
                          cout << "Seat no. 6 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s6 ="X";
           break;   
           
        case 7:
           if (seatnumber == 7)
           {
                          if  (s7 == "X")
                          cout << "Seat no.7 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s7 ="X";
           break;
            case 8:
           if (seatnumber == 8)
           
                          if  (s8 == "X")
                          cout << "Seat no. 8 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s8 ="X";
           break;   
           
             case 9:
           if (seatnumber == 9)
           {
                          if  (s9 == "X")
                          cout << "Seat no. 9 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s9 ="X";
           break;
            case 10:
           if (seatnumber == 10)
           
                          if  (s10 == "X")
                          cout << "Seat no. 10 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s10 ="X";
           break;   
          
          case 11:
           if (seatnumber == 11)
             {
                          if (s11 == "X")
                          cout << "Seat no. 11 is already reserved, please choose another seat.\n";
                          else 
                          total+=ticketprice;
             } 
          
           s11 ="X";
           break;
           
        case 12:
           if (seatnumber == 12)
           
                          if  (s12 == "X")
                          cout << "Seat no. 12 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s12 ="X";
           break;   
           
        case 13:
           if (seatnumber == 13)
           {
                          if  (s13 == "X")
                          cout << "Seat no. 13 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s13 ="X";
           break;
            case 14 :
           if (seatnumber == 14)
           
                          if  (s14 == "X")
                          cout << "Seat no. 14 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s14 ="X";
           break;   
           
        case 15:
           if (seatnumber == 15)
           {
                          if  (s15 == "X")
                          cout << "Seat no. 15 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s15 ="X";
           break;
            case 16:
           if (seatnumber == 16)
           
                          if  (s16 == "X")
                          cout << "Seat no. 16 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s16 ="X";
           break;   
           
        case 17:
           if (seatnumber == 17)
           {
                          if  (s17 == "X")
                          cout << "Seat no. 17 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s17 ="X";
           break;
            case 18:
           if (seatnumber == 18)
           
                          if  (s18 == "X")
                          cout << "Seat no. 18 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s18 ="X";
           break;   
           
             case 19:
           if (seatnumber == 19)
           {
                          if  (s19 == "X")
                          cout << "Seat no. 19 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s19 ="X";
           break;
            case 20:
           if (seatnumber == 20)
           
                          if  (s20 == "X")
                          cout << "Seat no. 20  is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s20 ="X";
           break;   
          
          case 21:
           if (seatnumber == 21)
             {
                          if (s1 == "X")
                          cout << "Seat no. 21 is already reserved, please choose another seat.\n";
                          else 
                          total+=ticketprice;
             } 
          
           s21 ="X";
           break;
           
        case 22:
           if (seatnumber == 22)
           
                          if  (s22 == "X")
                          cout << "Seat no. 22 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s22 ="X";
           break;   
           
        case 23:
           if (seatnumber == 23)
           {
                          if  (s23 == "X")
                          cout << "Seat no. 23 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s23 ="X";
           break;
            case 24:
           if (seatnumber == 24)
           
                          if  (s24 == "X")
                          cout << "Seat no. 24 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s24 ="X";
           break;   
           
        case 25:
           if (seatnumber == 25)
           {
                          if  (s25 == "X")
                          cout << "Seat no. 25 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s25 ="X";
           break;
            case 26:
           if (seatnumber == 26)
           
                          if  (s26 == "X")
                          cout << "Seat no. 26 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s26 ="X";
           break;   
           
        case 27:
           if (seatnumber == 27)
           {
                          if  (s27 == "X")
                          cout << "Seat no. 27 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s27 ="X";
           break;
            case 28:
           if (seatnumber == 28)
           
                          if  (s28 == "X")
                          cout << "Seat no. 28 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s28 ="X";
           break;   
           
             case 29:
           if (seatnumber == 29)
           {
                          if  (s29 == "X")
                          cout << "Seat no. 29 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s29 ="X";
           break;
            case 30:
           if (seatnumber == 30)
           
                          if  (s30 == "X")
                          cout << "Seat no. 30 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s30 ="X";
           break;   
          
          case 31:
           if (seatnumber == 31)
             {
                          if (s31 == "X")
                          cout << "Seat no. 31 is already reserved, please choose another seat.\n";
                          else 
                          total+=ticketprice;
             } 
          
           s31 ="X";
           break;
           
        case 32:
           if (seatnumber == 32)
           
                          if  (s32 == "X")
                          cout << "Seat no. 32 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s32 ="X";
           break;   
           
        case 33:
           if (seatnumber == 33)
           {
                          if  (s33 == "X")
                          cout << "Seat no. 33 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s33 ="X";
           break;
            case 34:
           if (seatnumber == 34)
           
                          if  (s34 == "X")
                          cout << "Seat no. 34 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s34 ="X";
           break;   
           
        case 35:
           if (seatnumber == 35)
           {
                          if  (s35 == "X")
                          cout << "Seat no. 35 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s35 ="X";
           break;
            case 36:
           if (seatnumber == 36)
           
                          if  (s36 == "X")
                          cout << "Seat no. 36 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s36 ="X";
           break;   
           
        case 37:
           if (seatnumber == 37)
           {
                          if  (s37 == "X")
                          cout << "Seat no. 37 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s37 ="X";
           break;
            case 38:
           if (seatnumber == 38)
           
                          if  (s38 == "X")
                          cout << "Seat no. 38 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s38 ="X";
           break;   
           
             case 39:
           if (seatnumber == 39)
           {
                          if  (s39 == "X")
                          cout << "Seat no. 39 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s39 ="X";
           break;
            case 40:
           if (seatnumber == 40)
           
                          if  (s40 == "X")
                          cout << "Seat no. 40 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s40 ="X";
           break;   
           
           
           case 41:
           if (seatnumber == 41)
             {
                          if (s41 == "X")
                          cout << "Seat no. 41 is already reserved, please choose another seat.\n";
                          else 
                          total+=ticketprice;
             } 
          
           s41 ="X";
           break;
           
        case 42:
           if (seatnumber == 42)
           
                          if  (s42 == "X")
                          cout << "Seat no. 42 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s42 ="X";
           break;   
           
        case 43:
           if (seatnumber == 43)
           {
                          if  (s43 == "X")
                          cout << "Seat no. 43 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s43 ="X";
           break;
            case 44:
           if (seatnumber == 44)
           
                          if  (s44 == "X")
                          cout << "Seat no. 44 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s44 ="X";
           break;   
           
        case 45:
           if (seatnumber == 45)
           {
                          if  (s45 == "X")
                          cout << "Seat no. 45 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s45 ="X";
           break;
            case 46:
           if (seatnumber == 46)
           
                          if  (s46 == "X")
                          cout << "Seat no. 46 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s46 ="X";
           break;   
           
        case 47:
           if (seatnumber == 47)
           {
                          if  (s47 == "X")
                          cout << "Seat no.47 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s47 ="X";
           break;
            case 48:
           if (seatnumber == 48)
           
                          if  (s48 == "X")
                          cout << "Seat no. 48 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s48 ="X";
           break;   
           
             case 49:
           if (seatnumber == 49)
           {
                          if  (s49 == "X")
                          cout << "Seat no. 49 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s49 ="X";
           break;
            case 50:
           if (seatnumber == 50)
           
                          if  (s50 == "X")
                          cout << "Seat no. 50 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s50 ="X";
           break;   
          
          case 51:
           if (seatnumber == 51)
             {
                          if (s51 == "X")
                          cout << "Seat no. 51 is already reserved, please choose another seat.\n";
                          else 
                          total+=ticketprice;
             } 
          
           s51 ="X";
           break;
           
        case 52:
           if (seatnumber == 52)
           
                          if  (s52 == "X")
                          cout << "Seat no. 52 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s52 ="X";
           break;   
           
        case 53:
           if (seatnumber == 53)
           {
                          if  (s53 == "X")
                          cout << "Seat no. 53 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s53 ="X";
           break;
            case 54:
           if (seatnumber == 54)
           
                          if  (s54 == "X")
                          cout << "Seat no. 54 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s54 ="X";
           break;   
           
        case 55:
           if (seatnumber == 55)
           {
                          if  (s55 == "X")
                          cout << "Seat no. 55 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s55 ="X";
           break;
            case 56:
           if (seatnumber == 56)
           
                          if  (s56 == "X")
                          cout << "Seat no. 56 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s56 ="X";
           break;   
           
        case 57:
           if (seatnumber == 57)
           {
                          if  (s57 == "X")
                          cout << "Seat no. 57 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s57 ="X";
           break;
            case 58 :
           if (seatnumber == 58)
           
                          if  (s58 == "X")
                          cout << "Seat no. 58 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s58 ="X";
           break;   
           
             case 59:
           if (seatnumber == 59)
           {
                          if  (s59 == "X")
                          cout << "Seat no. 59 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s59 ="X";
           break;
           
           
           case 60:
           if (seatnumber == 60)
             {
                          if (s60 == "X")
                          cout << "Seat no. 60 is already reserved, please choose another seat.\n";
                          else 
                          total+=ticketprice;
             } 
          
           s60 ="X";
           break;
           
        case 61:
           if (seatnumber == 61)
           
                          if  (s61 == "X")
                          cout << "Seat no. 61 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s61 ="X";
           break;   
           
        case 62:
           if (seatnumber == 62)
           {
                          if  (s62 == "X")
                          cout << "Seat no. 62 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s62 ="X";
           break;
            case 63:
           if (seatnumber == 63)
           
                          if  (s63 == "X")
                          cout << "Seat no. 63 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s63 ="X";
           break;   
           
        case 64:
           if (seatnumber == 64)
           {
                          if  (s64 == "X")
                          cout << "Seat no. 64 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s64 ="X";
           break;
            case 65:
           if (seatnumber == 65)
           
                          if  (s65 == "X")
                          cout << "Seat no. 65 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s65 ="X";
           break;   
           
        case 66:
           if (seatnumber == 66)
           {
                          if  (s66 == "X")
                          cout << "Seat no. 66 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s66 ="X";
           break;
            case 67:
           if (seatnumber == 67)
           
                          if  (s67 == "X")
                          cout << "Seat no. 67 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s67 ="X";
           break;   
           
             case 68:
           if (seatnumber == 68)
           {
                          if  (s68 == "X")
                          cout << "Seat no. 68 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s68 ="X";
           break;
            case 69:
           if (seatnumber == 69)
           
                          if  (s69 == "X")
                          cout << "Seat no. 69 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s69 ="X";
           break;   
          
          case 70:
           if (seatnumber == 70)
             {
                          if (s70 == "X")
                          cout << "Seat no. 70 is already reserved, please choose another seat.\n";
                          else 
                          total+=ticketprice;
             } 
          
           s70 ="X";
           break;
           
        case 71:
           if (seatnumber == 71)
           
                          if  (s71 == "X")
                          cout << "Seat no. 71 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s71 ="X";
           break;   
           
        case 72:
           if (seatnumber == 72)
           {
                          if  (s72 == "X")
                          cout << "Seat no. 72 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s72 ="X";
           break;
            case 73:
           if (seatnumber == 73)
           
                          if  (s73 == "X")
                          cout << "Seat no. 73 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s73 ="X";
           break;   
           
        case 74:
           if (seatnumber == 74)
           {
                          if  (s74 == "X")
                          cout << "Seat no. 74 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s74 ="X";
           break;
            case 75:
           if (seatnumber == 75)
           
                          if  (s75 == "X")
                          cout << "Seat no. 75 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s75 ="X";
           break;   
           
        case 76:
           if (seatnumber == 76)
           {
                          if  (s76 == "X")
                          cout << "Seat no. 76 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s76 ="X";
           break;
            case 77:
           if (seatnumber == 77)
           
                          if  (s77 == "X")
                          cout << "Seat no. 77 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s77 ="X";
           break;   
           
             case 78:
           if (seatnumber == 78)
           {
                          if  (s78 == "X")
                          cout << "Seat no. 78 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s78 ="X";
           break;
            case 79:
           if (seatnumber == 79)
           
                          if  (s79 == "X")
                          cout << "Seat no. 79 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s79 ="X";
           break;   
           
           case 80:
           if (seatnumber == 80)
             {
                          if (s80 == "X")
                          cout << "Seat no. 80 is already reserved, please choose another seat.\n";
                          else 
                          total+=ticketprice;
             } 
          
           s80 ="X";
           break;
           
        case 81:
           if (seatnumber == 81)
           
                          if  (s81 == "X")
                          cout << "Seat no. 81 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s81 ="X";
           break;   
           
        case 82:
           if (seatnumber == 82)
           {
                          if  (s82 == "X")
                          cout << "Seat no. 82 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s82 ="X";
           break;
            case 83:
           if (seatnumber == 83)
           
                          if  (s83 == "X")
                          cout << "Seat no. 83 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s83 ="X";
           break;   
           
        case 84:
           if (seatnumber == 84)
           {
                          if  (s84 == "X")
                          cout << "Seat no. 84 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s84 ="X";
           break;
            case 85:
           if (seatnumber == 85)
           
                          if  (s85 == "X")
                          cout << "Seat no. 85 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s85 ="X";
           break;   
           
        case 86:
           if (seatnumber == 86)
           {
                          if  (s86 == "X")
                          cout << "Seat no. 86 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s86 ="X";
           break;
            case 87:
           if (seatnumber == 87)
           
                          if  (s87 == "X")
                          cout << "Seat no. 87 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s87 ="X";
           break;   
           
             case 88:
           if (seatnumber == 88)
           {
                          if  (s88 == "X")
                          cout << "Seat no. 88 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s88 ="X";
           break;
            case 89:
           if (seatnumber == 89)
           
                          if  (s89 == "X")
                          cout << "Seat no. 89 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s89 ="X";
           break;   
          
          case 90:
           if (seatnumber == 90)
             {
                          if (s90 == "X")
                          cout << "Seat no. 90 is already reserved, please choose another seat.\n";
                          else 
                          total+=ticketprice;
             } 
          
           s90 ="X";
           break;
           
        case 91:
           if (seatnumber == 91)
           
                          if  (s91 == "X")
                          cout << "Seat no. 91 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s91 ="X";
           break;   
           
        case 92:
           if (seatnumber == 92)
           {
                          if  (s92 == "X")
                          cout << "Seat no. 92 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s92 ="X";
           break;
            case 93:
           if (seatnumber == 93)
           
                          if  (s93 == "X")
                          cout << "Seat no. 93 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s93 ="X";
           break;   
           
        case 94:
           if (seatnumber == 94)
           {
                          if  (s94 == "X")
                          cout << "Seat no. 94 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s94 ="X";
           break;
            case 95:
           if (seatnumber == 95)
           
                          if  (s95 == "X")
                          cout << "Seat no. 95 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s95 ="X";
           break;   
           
        case 96:
           if (seatnumber == 96)
           {
                          if  (s96 == "X")
                          cout << "Seat no. 96 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s96 ="X";
           break;
            case 97:
           if (seatnumber == 97)
           
                          if  (s97 == "X")
                          cout << "Seat no. 97 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s97 ="X";
           break;   
           
             case 98:
           if (seatnumber == 98)
           {
                          if  (s98 == "X")
                          cout << "Seat no. 98 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s98 ="X";
           break;
            case 99:
           if (seatnumber == 99)
           
                          if  (s99 == "X")
                          cout << "Seat no. 99 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s99 ="X";
           break;   
           
           case 100:
           if (seatnumber == 100)
             {
                          if (s100 == "X")
                          cout << "Seat no. 100 is already reserved, please choose another seat.\n";
                          else 
                          total+=ticketprice;
             } 
          
           s100 ="X";
           break;
           
           case 101:
           if (seatnumber == 101)
             {
                          if (s101 == "X")
                          cout << "Seat no. 101 is already reserved, please choose another seat.\n";
                          else 
                          total+=ticketprice;
             } 
          
           s101 ="X";
           break;
           
        case 102:
           if (seatnumber == 102)
           
                          if  (s102 == "X")
                          cout << "Seat no. 102 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s102 ="X";
           break;   
           
        case 103:
           if (seatnumber == 103)
           {
                          if  (s103 == "X")
                          cout << "Seat no. 103 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s103 ="X";
           break;
            case 104:
           if (seatnumber == 104)
           
                          if  (s104 == "X")
                          cout << "Seat no. 104 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s104 ="X";
           break;   
           
        case 105:
           if (seatnumber == 105)
           {
                          if  (s105 == "X")
                          cout << "Seat no. 105 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s105 ="X";
           break;
            case 106:
           if (seatnumber == 106)
           
                          if  (s106 == "X")
                          cout << "Seat no. 106 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s106 ="X";
           break;   
           
        case 107:
           if (seatnumber == 107)
           {
                          if  (s107 == "X")
                          cout << "Seat no. 107 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s107 ="X";
           break;
            case 108:
           if (seatnumber == 108)
           
                          if  (s108 == "X")
                          cout << "Seat no. 108 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s108 ="X";
           break;   
           
             case 109:
           if (seatnumber == 109)
           {
                          if  (s109 == "X")
                          cout << "Seat no. 109 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s109 ="X";
           break;
            case 110:
           if (seatnumber == 110)
           
                          if  (s110 == "X")
                          cout << "Seat no. 110 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s110 ="X";
           break;   
          
          case 111:
           if (seatnumber == 111)
             {
                          if (s111 == "X")
                          cout << "Seat no. 111 is already reserved, please choose another seat.\n";
                          else 
                          total+=ticketprice;
             } 
          
           s111 ="X";
           break;
           
        case 112:
           if (seatnumber == 112)
           
                          if  (s112 == "X")
                          cout << "Seat no. 112 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s112 ="X";
           break;   
           
        case 113:
           if (seatnumber == 113)
           {
                          if  (s113 == "X")
                          cout << "Seat no. 113 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s113 ="X";
           break;
            case 114 :
           if (seatnumber == 114)
           
                          if  (s114 == "X")
                          cout << "Seat no. 114 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s114 ="X";
           break;   
           
        case 115:
           if (seatnumber == 115)
           {
                          if  (s115 == "X")
                          cout << "Seat no. 115 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s115 ="X";
           break;
            case 116:
           if (seatnumber == 116)
           
                          if  (s116 == "X")
                          cout << "Seat no. 116 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s116 ="X";
           break;   
           
        case 117:
           if (seatnumber == 117)
           {
                          if  (s117 == "X")
                          cout << "Seat no. 117 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s117 ="X";
           break;
            case 118:
           if (seatnumber == 118)
           
                          if  (s118 == "X")
                          cout << "Seat no. 118 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s118 ="X";
           break;   
           
             case 119:
           if (seatnumber == 119)
           {
                          if  (s119 == "X")
                          cout << "Seat no. 119 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s119 ="X";
           break;
            case 120:
           if (seatnumber == 120)
           
                          if  (s120 == "X")
                          cout << "Seat no. 120  is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s120 ="X";
           break;   
          
          case 121:
           if (seatnumber == 121)
             {
                          if (s121 == "X")
                          cout << "Seat no. 121 is already reserved, please choose another seat.\n";
                          else 
                          total+=ticketprice;
             } 
          
           s121 ="X";
           break;
           
        case 122:
           if (seatnumber == 122)
           
                          if  (s122 == "X")
                          cout << "Seat no. 122 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s122 ="X";
           break;   
           
        case 123:
           if (seatnumber == 123)
           {
                          if  (s123 == "X")
                          cout << "Seat no. 123 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s123 ="X";
           break;
            case 124:
           if (seatnumber == 124)
           
                          if  (s124 == "X")
                          cout << "Seat no. 124 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s124 ="X";
           break;   
           
        case 125:
           if (seatnumber == 125)
           {
                          if  (s125 == "X")
                          cout << "Seat no. 125 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s125 ="X";
           break;
            case 126:
           if (seatnumber == 126)
           
                          if  (s126 == "X")
                          cout << "Seat no. 126 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s126 ="X";
           break;   
           
        case 127:
           if (seatnumber == 127)
           {
                          if  (s127 == "X")
                          cout << "Seat no. 127 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s127 ="X";
           break;
            case 128:
           if (seatnumber == 128)
           
                          if  (s128 == "X")
                          cout << "Seat no. 128 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s128 ="X";
           break;   
           
             case 129:
           if (seatnumber == 129)
           {
                          if  (s129 == "X")
                          cout << "Seat no. 129 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s129 ="X";
           break;
            case 130:
           if (seatnumber == 130)
           
                          if  (s130 == "X")
                          cout << "Seat no. 130 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s130 ="X";
           break;   
          
          case 131:
           if (seatnumber == 131)
             {
                          if (s131 == "X")
                          cout << "Seat no. 131 is already reserved, please choose another seat.\n";
                          else 
                          total+=ticketprice;
             } 
          
           s131 ="X";
           break;
           
        case 132:
           if (seatnumber == 132)
           
                          if  (s132 == "X")
                          cout << "Seat no. 132 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s132 ="X";
           break;   
           
        case 133:
           if (seatnumber == 133)
           {
                          if  (s133 == "X")
                          cout << "Seat no. 133 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s133 ="X";
           break;
            case 134:
           if (seatnumber == 134)
           
                          if  (s134 == "X")
                          cout << "Seat no. 134 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s134 ="X";
           break;   
           
        case 135:
           if (seatnumber == 135)
           {
                          if  (s135 == "X")
                          cout << "Seat no. 135 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s135 ="X";
           break;
            case 136:
           if (seatnumber == 136)
           
                          if  (s136 == "X")
                          cout << "Seat no. 136 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s136 ="X";
           break;   
           
        case 137:
           if (seatnumber == 137)
           {
                          if  (s137 == "X")
                          cout << "Seat no. 137 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s137 ="X";
           break;
            case 138:
           if (seatnumber == 138)
           
                          if  (s138 == "X")
                          cout << "Seat no. 138 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s138 ="X";
           break;   
           
             case 139:
           if (seatnumber == 139)
           {
                          if  (s139 == "X")
                          cout << "Seat no. 139 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s139 ="X";
           break;
            case 140:
           if (seatnumber == 140)
           
                          if  (s140 == "X")
                          cout << "Seat no. 140 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s140 ="X";
           break;   
           
           
           case 141:
           if (seatnumber == 141)
             {
                          if (s141 == "X")
                          cout << "Seat no. 141 is already reserved, please choose another seat.\n";
                          else 
                          total+=ticketprice;
             } 
          
           s141 ="X";
           break;
           
        case 142:
           if (seatnumber == 142)
           
                          if  (s142 == "X")
                          cout << "Seat no. 142 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s142 ="X";
           break;   
           
        case 143:
           if (seatnumber == 143)
           {
                          if  (s143 == "X")
                          cout << "Seat no. 143 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s143 ="X";
           break;
            case 144:
           if (seatnumber == 144)
           
                          if  (s144 == "X")
                          cout << "Seat no. 144 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s144 ="X";
           break;   
           
        case 145:
           if (seatnumber == 145)
           {
                          if  (s145 == "X")
                          cout << "Seat no. 145 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s145 ="X";
           break;
            case 146:
           if (seatnumber == 146)
           
                          if  (s146 == "X")
                          cout << "Seat no. 146 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s146 ="X";
           break;   
           
        case 147:
           if (seatnumber == 147)
           {
                          if  (s147 == "X")
                          cout << "Seat no.147 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s147 ="X";
           break;
            case 148:
           if (seatnumber == 148)
           
                          if  (s148 == "X")
                          cout << "Seat no. 148 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s148 ="X";
           break;   
           
             case 149:
           if (seatnumber == 149)
           {
                          if  (s149 == "X")
                          cout << "Seat no. 149 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s149 ="X";
           break;
            case 150:
           if (seatnumber == 150)
           
                          if  (s150 == "X")
                          cout << "Seat no. 150 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s150 ="X";
           break;   
          
          case 151:
           if (seatnumber == 151)
             {
                          if (s151 == "X")
                          cout << "Seat no. 151 is already reserved, please choose another seat.\n";
                          else 
                          total+=ticketprice;
             } 
          
           s151 ="X";
           break;
           
        case 152:
           if (seatnumber == 152)
           
                          if  (s152 == "X")
                          cout << "Seat no. 152 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s152 ="X";
           break;   
           
        case 153:
           if (seatnumber == 153)
           {
                          if  (s153 == "X")
                          cout << "Seat no. 153 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s153 ="X";
           break;
            case 154:
           if (seatnumber == 154)
           
                          if  (s154 == "X")
                          cout << "Seat no. 154 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s154 ="X";
           break;   
           
        case 155:
           if (seatnumber == 155)
           {
                          if  (s155 == "X")
                          cout << "Seat no. 155 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s155 ="X";
           break;
            case 156:
           if (seatnumber == 156)
           
                          if  (s156 == "X")
                          cout << "Seat no. 156 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s156 ="X";
           break;   
           
        case 157:
           if (seatnumber == 157)
           {
                          if  (s157 == "X")
                          cout << "Seat no. 157 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s157 ="X";
           break;
            case 158 :
           if (seatnumber == 158)
           
                          if  (s158 == "X")
                          cout << "Seat no. 158 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s158 ="X";
           break;   
           
             
         
           break;
            case 159:
           if (seatnumber == 159)
           
                          if  (s159 == "X")
                          cout << "Seat no. 159 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s159 ="X";
           break;   
           
           case 160:
           if (seatnumber == 160)
             {
                          if (s160 == "X")
                          cout << "Seat no. 160 is already reserved, please choose another seat.\n";
                          else 
                          total+=ticketprice;
             } 
          
           s160 ="X";
           break;
           
        case 161:
           if (seatnumber == 161)
           
                          if  (s161 == "X")
                          cout << "Seat no. 161 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s161 ="X";
           break;   
           
        case 162:
           if (seatnumber == 162)
           {
                          if  (s162 == "X")
                          cout << "Seat no. 162 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s162 ="X";
           break;
            case 163:
           if (seatnumber == 163)
           
                          if  (s163 == "X")
                          cout << "Seat no. 163 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s163 ="X";
           break;   
           
        case 164:
           if (seatnumber == 164)
           {
                          if  (s164 == "X")
                          cout << "Seat no. 164 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s164 ="X";
           break;
            case 165:
           if (seatnumber == 165)
           
                          if  (s165 == "X")
                          cout << "Seat no. 165 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s165 ="X";
           break;   
           
        case 166:
           if (seatnumber == 166)
           {
                          if  (s66 == "X")
                          cout << "Seat no. 166 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s166 ="X";
           break;
            case 167:
           if (seatnumber == 167)
           
                          if  (s167 == "X")
                          cout << "Seat no. 167 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s167 ="X";
           break;   
           
             case 168:
           if (seatnumber == 168)
           {
                          if  (s168 == "X")
                          cout << "Seat no. 168 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s168 ="X";
           break;
            case 169:
           if (seatnumber == 169)
           
                          if  (s169 == "X")
                          cout << "Seat no. 169 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s169 ="X";
           break;   
          
          case 170:
           if (seatnumber == 170)
             {
                          if (s170 == "X")
                          cout << "Seat no. 170 is already reserved, please choose another seat.\n";
                          else 
                          total+=ticketprice;
             } 
          
           s170 ="X";
           break;
           
        case 171:
           if (seatnumber == 171)
           
                          if  (s171 == "X")
                          cout << "Seat no. 171 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s171 ="X";
           break;   
           
        case 172:
           if (seatnumber == 172)
           {
                          if  (s172 == "X")
                          cout << "Seat no. 172 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s172 ="X";
           break;
            case 173:
           if (seatnumber == 173)
           
                          if  (s173 == "X")
                          cout << "Seat no. 173 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s173 ="X";
           break;   
           
        case 174:
           if (seatnumber == 174)
           {
                          if  (s174 == "X")
                          cout << "Seat no. 174 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s174 ="X";
           break;
            case 175:
           if (seatnumber == 175)
           
                          if  (s175 == "X")
                          cout << "Seat no. 175 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s175 ="X";
           break;   
           
        case 176:
           if (seatnumber == 176)
           {
                          if  (s176 == "X")
                          cout << "Seat no. 176 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s176 ="X";
           break;
            case 177:
           if (seatnumber == 177)
           
                          if  (s177 == "X")
                          cout << "Seat no. 177 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s177 ="X";
           break;   
           
             case 178:
           if (seatnumber == 178)
           {
                          if  (s178 == "X")
                          cout << "Seat no. 178 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s178 ="X";
           break;
            case 179:
           if (seatnumber == 179)
           
                          if  (s179 == "X")
                          cout << "Seat no. 179 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s179 ="X";
           break;   
           
           case 180:
           if (seatnumber == 180)
             {
                          if (s180 == "X")
                          cout << "Seat no. 180 is already reserved, please choose another seat.\n";
                          else 
                          total+=ticketprice;
             } 
          
           s180 ="X";
           break;
           
        case 181:
           if (seatnumber == 181)
           
                          if  (s181 == "X")
                          cout << "Seat no. 181 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s181 ="X";
           break;   
           
        case 182:
           if (seatnumber == 182)
           {
                          if  (s182 == "X")
                          cout << "Seat no. 182 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s182 ="X";
           break;
            case 183:
           if (seatnumber == 183)
           
                          if  (s183 == "X")
                          cout << "Seat no. 183 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s183 ="X";
           break;   
           
        case 184:
           if (seatnumber == 184)
           {
                          if  (s184 == "X")
                          cout << "Seat no. 184 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s184 ="X";
           break;
            case 185:
           if (seatnumber == 185)
           
                          if  (s185 == "X")
                          cout << "Seat no. 185 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s185 ="X";
           break;   
           
        case 186:
           if (seatnumber == 186)
           {
                          if  (s186 == "X")
                          cout << "Seat no. 186 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s186 ="X";
           break;
            case 187:
           if (seatnumber == 187)
           
                          if  (s187 == "X")
                          cout << "Seat no. 187 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s187 ="X";
           break;   
           
             case 188:
           if (seatnumber == 188)
           {
                          if  (s188 == "X")
                          cout << "Seat no. 188 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s188 ="X";
           break;
            case 189:
           if (seatnumber == 189)
           
                          if  (s189 == "X")
                          cout << "Seat no. 189 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s189 ="X";
           break;   
          
          case 190:
           if (seatnumber == 190)
             {
                          if (s190 == "X")
                          cout << "Seat no. 190 is already reserved, please choose another seat.\n";
                          else 
                          total+=ticketprice;
             } 
          
           s190 ="X";
           break;
           
        case 191:
           if (seatnumber == 191)
           
                          if  (s191 == "X")
                          cout << "Seat no. 191 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s191 ="X";
           break;   
           
        case 192:
           if (seatnumber == 192)
           {
                          if  (s192 == "X")
                          cout << "Seat no. 192 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s192 ="X";
           break;
            case 193:
           if (seatnumber == 193)
           
                          if  (s193 == "X")
                          cout << "Seat no. 193 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s193 ="X";
           break;   
           
        case 194:
           if (seatnumber == 194)
           {
                          if  (s194 == "X")
                          cout << "Seat no. 194 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s194 ="X";
           break;
            case 195:
           if (seatnumber == 195)
           
                          if  (s195 == "X")
                          cout << "Seat no. 195 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s195 ="X";
           break;   
           
        case 196:
           if (seatnumber == 196)
           {
                          if  (s196 == "X")
                          cout << "Seat no. 196 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s196 ="X";
           break;
            case 197:
           if (seatnumber == 197)
           
                          if  (s197 == "X")
                          cout << "Seat no. 197 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s197 ="X";
           break;   
           
             case 198:
           if (seatnumber == 198)
           {
                          if  (s198 == "X")
                          cout << "Seat no. 198 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s198 ="X";
           break;
            case 199:
           if (seatnumber == 199)
           
                          if  (s199 == "X")
                          cout << "Seat no. 199 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s199 ="X";
           break;   
           
           case 200:
           if (seatnumber == 200)
             {
                          if (s200 == "X")
                          cout << "Seat no. 200 is already reserved, please choose another seat.\n";
                          else 
                          total+=ticketprice;
             } 
          
           s200 ="X";
           break;
              
        default:
        cout <<"Error!";
        }
        
        cout << " [============================================================================]" <<endl;
         cout << " |                               CINEMA   SCREEN                              |" <<endl;
         cout << " [============================================================================]" <<endl;
        
        cout <<"     "<< "[" <<s1<< "]" << "[" <<s2<< "]" << "[" <<s3<< "]" << "[" <<s4<< "]" << "[" <<s5<< "]" << "[" <<s6<< "]" << "[" <<s7<< "]" << "[" <<s8<< "]"  << "[" <<s9<< "]" << "[" <<s10<< "]" << "[" <<s11<< "]" << "[" <<s12<< "]" << "[" <<s13<< "]" << "[" <<s14<< "]" << "[" <<s15<< "]" << "[" <<s16<< "]" << "[" <<s17<< "]" << "[" <<s18<< "]"  << "[" <<s19<< "]" << "[" <<s20<< "]"<<endl<<endl 
           << "[" <<s21<< "]" << "[" <<s22<< "]" << "[" <<s23<< "]" << "[" <<s24<< "]" << "[" <<s25<< "]" << "[" <<s26<< "]" << "[" <<s27<< "]" << "[" <<s28<< "]"  << "[" <<s29<< "]" << "[" <<s30<< "]" << "[" <<s31<< "]" << "[" <<s32<< "]" << "[" <<s33<< "]" << "[" <<s34<< "]" << "[" <<s35<< "]" << "[" <<s36<< "]" << "[" <<s37<< "]" << "[" <<s38<< "]"  << "[" <<s39<< "]" << "[" <<s40<< "]"<<endl
           << "[" <<s41<< "]" << "[" <<s42<< "]" << "[" <<s43<< "]" << "[" <<s44<< "]" << "[" <<s45<< "]" << "[" <<s46<< "]" << "[" <<s47<< "]" << "[" <<s48<< "]"  << "[" <<s49<< "]" << "[" <<s50<< "]" << "[" <<s51<< "]" << "[" <<s52<< "]" << "[" <<s53<< "]" << "[" <<s54<< "]" << "[" <<s55<< "]" << "[" <<s56<< "]" << "[" <<s57<< "]" << "[" <<s58<< "]"  << "[" <<s59<< "]" << "[" <<s60<< "]"<<endl 
           << "[" <<s61<< "]" << "[" <<s62<< "]" << "[" <<s63<< "]" << "[" <<s64<< "]" << "[" <<s65<< "]" << "[" <<s66<< "]" << "[" <<s67<< "]" << "[" <<s68<< "]"  << "[" <<s69<< "]" << "[" <<s70<< "]" << "[" <<s71<< "]" << "[" <<s72<< "]" << "[" <<s73<< "]" << "[" <<s74<< "]" << "[" <<s75<< "]" << "[" <<s76<< "]" << "[" <<s77<< "]" << "[" <<s78<< "]"  << "[" <<s79<< "]" << "[" <<s80<< "]"<<endl
           << "[" <<s81<< "]" << "[" <<s82<< "]" << "[" <<s83<< "]" << "[" <<s84<< "]" << "[" <<s85<< "]" << "[" <<s86<< "]" << "[" <<s87<< "]" << "[" <<s88<< "]"  << "[" <<s89<< "]" << "[" <<s90<< "]" << "[" <<s91<< "]" << "[" <<s92<< "]" << "[" <<s93<< "]" << "[" <<s94<< "]" << "[" <<s95<< "]" << "[" <<s96<< "]" << "[" <<s97<< "]" << "[" <<s98<< "]"  << "[" <<s99<< "]" << "[" <<s100<< "]"<<endl 
           << "[" <<s101<< "]" << "[" <<s102<< "]" << "[" <<s103<< "]" << "[" <<s104<< "]" << "[" <<s105<< "]" << "[" <<s106<< "]" << "[" <<s107<< "]" << "[" <<s108<< "]"  << "[" <<s109<< "]" << "[" <<s110<< "]" << "[" <<s111<< "]" << "[" <<s112<< "]" << "[" <<s113<< "]" << "[" <<s114<< "]" << "[" <<s115<< "]" << "[" <<s116<< "]"<<endl << "                              " << "[" <<s117<< "]" << "[" <<s118<< "]"  << "[" <<s119<< "]" << "[" <<s120<< "]"<<endl<<endl
           << "[" <<s121<< "]" << "[" <<s122<< "]" << "[" <<s123<< "]" << "[" <<s124<< "]" << "[" <<s125<< "]" << "[" <<s126<< "]" << "[" <<s127<< "]" << "[" <<s128<< "]"  << "[" <<s129<< "]" << "[" <<s130<< "]" << "[" <<s131<< "]" << "[" <<s132<< "]" << "[" <<s133<< "]" << "[" <<s134<< "]" << "[" <<s135<< "]" << "[" <<s136<< "]"<<endl << "                              " << "[" <<s137<< "]" << "[" <<s138<< "]"  << "[" <<s139<< "]" << "[" <<s140<< "]"<<endl<<endl 
           << "[" <<s141<< "]" << "[" <<s142<< "]" << "[" <<s143<< "]" << "[" <<s144<< "]" << "[" <<s145<< "]" << "[" <<s146<< "]" << "[" <<s147<< "]" << "[" <<s148<< "]"  << "[" <<s149<< "]" << "[" <<s150<< "]" << "[" <<s151<< "]" << "[" <<s152<< "]" << "[" <<s153<< "]" << "[" <<s154<< "]" << "[" <<s155<< "]" << "[" <<s156<< "]"<<endl << "                              " << "[" <<s157<< "]" << "[" <<s158<< "]"  << "[" <<s159<< "]" << "[" <<s160<< "]"<<endl<<endl
           << "[" <<s161<< "]" << "[" <<s162<< "]" << "[" <<s163<< "]" << "[" <<s164<< "]" << "[" <<s165<< "]" << "[" <<s166<< "]" << "[" <<s167<< "]" << "[" <<s168<< "]"  << "[" <<s169<< "]" << "[" <<s170<< "]" << "[" <<s171<< "]" << "[" <<s172<< "]" << "[" <<s173<< "]" << "[" <<s174<< "]" << "[" <<s175<< "]" << "[" <<s176<< "]"<<endl << "                              " << "[" <<s177<< "]" << "[" <<s178<< "]"  << "[" <<s179<< "]" << "[" <<s180<< "]"<<endl<<endl 
           << "[" <<s181<< "]" << "[" <<s182<< "]" << "[" <<s183<< "]" << "[" <<s184<< "]" << "[" <<s185<< "]" << "[" <<s186<< "]" << "[" <<s187<< "]" << "[" <<s188<< "]"  << "[" <<s189<< "]" << "[" <<s190<< "]" << "[" <<s191<< "]" << "[" <<s192<< "]" << "[" <<s193<< "]" << "[" <<s194<< "]" << "[" <<s195<< "]" << "[" <<s196<< "]"<<endl << "                              " << "[" <<s197<< "]" << "[" <<s198<< "]"  << "[" <<s199<< "]" << "[" <<s200<< "]"<<endl<<endl;
           
   cout <<endl;
   cout << "Do you wish to reserve another seat? (Y/N)";
   cin >> ans;
}
while (ans!='n'&&ans!='N');
} 
     cout << endl;
     cout << endl;
     cout << endl;
     total += ticketprice;
{
     cout << "********************************************************************************" <<endl;
     cout << "                                 AT1 CINEMAS                                    ";
     cout << "                         Mapua Institute of Technology                          ";
     cout << "                    Room 109, School of Information Technology                  ";
     cout << "               333 Sen. Gil Puyat Ave., Makati City 1200 Philippines            " <<endl;                       
     cout << "************************ Here is your official receipt: ************************" <<endl;
     
     cout << "                       TIN #:  325867-97866-8776565-23456                       " <<endl;
     cout << endl;
     
}
{ 
     
   if (movie == 1)
     cout << "  You selected the movie: Wallstreet" <<endl;
     else if (movie == 2)
     cout << "  You selected the movie: The Social Network" << endl;
     else if (movie == 3)
     cout << "  You selected the movie: Takers" << endl;
     cout <<endl;
     cout << "  You have selected cinema number: "<<cinemanumber<<endl;
     cout <<endl;
     cout << "  TOTAL AMOUNT TO BE PAID: " <<"$"<< total <<endl;
     
     
     cout <<endl;
     cout <<endl;
     cout <<endl;
     cout << "                              THIS SERVES AS YOUR                               " 
          << "                               OFFICIAL RECEIPT                                 " <<endl;
     cout << "                         SN: 41-AM446/CN793677845SG-22                          " 
          << "                            PN: 1109-43B-59307-0356                             "
          << "                           AN: 116-000405340-0003403                            " <<endl;                         
          
     cout << "                      ---  THANK YOU AND COME AGAIN! ---                        " <<endl;
     cout << endl;
     cout << "********************************************************************************" <<endl;
         
}   
    system("PAUSE");
    return EXIT_SUCCESS;
}
FrancisLazo
Deleted Member

Before you learn about functions, I suggest you learn about how to write a loop and how to change the value of a variable.

I would learn to use arrays first, then functions. You can consolidate all of your tickets down to an array of characters (or eventually a std::string when you learn more about those).

Edited 5 Years Ago by jonsca: n/a

Before you learn about functions, I suggest you learn about how to write a loop and how to change the value of a variable.

I can already understand function works and how to use it but I am confused how I can combine it with my program, any idea how?

First see how much you can get rid of with arrays and loops, as arkoenig and I said before. That's the majority of it. You can package some of your menus and maybe the seat selection into a function.

I would learn to use arrays first, then functions. You can consolidate all of your tickets down to an array of characters (or eventually a std::string when you learn more about those).

isn't it that I should do something like this:

string s[200]

? I have knowledge with Arrays also its just that I did this program before Arrays and functions were discussed to us and so I'm going back to this program trying to apply my knowledge from the recently discussed topics.

You need to implement some arrays and loops first. Once you have done that, your code will condense significantly and it will be easier to see where functions will be most beneficial. You'll probably save 350-400 lines just by making this change.

Also, this:

switch (seatnumber)
  {
    case 1:
      if (seatnumber == 1)
      {
        if (s1 == "X")
          cout << "Seat no. 1 is already reserved, please choose another seat.\n";
        else 
          total+=ticketprice;
      } 
 
      s1 ="X";
      break;
    //...
  //...
  }

is terribly redundant. You can eliminate 400 lines by eliminating the if statements based on seatnumber, you already know that's the value, your switch case has taken care of that part of it. This is a much better way:

switch (seatnumber) {
  case 1:
    if (s1 == "X") {
      cout << "Seat no. 1 is already reserved, please choose another seat.\n";
    } else {
      total += ticketprict;
      s1 = "X";
    }
    break;
  //...
}

See how much less redundant, and shorter, my version is? It saved 5 lines on that one case alone. That's 1,000 lines over 200 cases.

When you combine this with my previous suggestion, you're looking at around a 1300-line savings which cuts your program down from 2243 hard-to read lines to around 900-950 easy-to-read lines. It seems small, but that's a huge change! That's about a 55% reduction!

Edited 5 Years Ago by Fbody: n/a

isn't it that I should do something like this:

string s[200]

? I have knowledge with Arrays also its just that I did this program before Arrays and functions were discussed to us and so I'm going back to this program trying to apply my knowledge from the recently discussed topics.

You can even use a single character array (as you don't need 200 different strings, you can have one character for each seat ):

char seats[5]; //let's use 5 for demonstration purposes, but yours would be 200 long
|  |  |  |  |  |   There are 5 seats available
|X |  |X |  |  |   Seats 0 and 2 (1st and 3rd) are taken

Edited 5 Years Ago by jonsca: n/a

First see how much you can get rid of with arrays and loops, as arkoenig and I said before. That's the majority of it. You can package some of your menus and maybe the seat selection into a function.

Question, can I use array for these swtich statements?:

case 1:
           if (seatnumber == 1)
            {  
                          if (s1 == "X")
                          cout << "Seat no. 1 is already reserved, please choose another seat.\n";
                          else 
                          total+=ticketprice;
             } 
          
           s1 ="X";
           break;
           
        case 2:
           if (seatnumber == 2)
           
                          if  (s2 == "X")
                          cout << "Seat no. 2 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           s2 ="X";
           break;   
           
        case 3:
           if (seatnumber == 3)
           {
                          if  (s3 == "X")
                          cout << "Seat no.3 is already reserved, please choose another seat.\n";
                          else
                          total+=ticketprice;
           } 
           s3 ="X";
           break; 

// up to case 200.

I think it is possible, it's just that I don't know how I can convert it...Help me please.

Yes. It should be possible to use the user's input, in conjunction with the array, to eliminate the switch statement.

Please don't use SMS/TXT. For the sake of readability and professionalism, the forum rules request that you use proper English to the best of your ability.

Keep it Clear
Do post in full-sentence English
Do wrap your programming code blocks within [code] ... [/code] tags
Do use clear and relevant titles for new threads
Do not write in all uppercase or use "leet", "txt" or "chatroom" speak

I doubt the OP is familiar with enums just yet. Besides, they really won't simplify anything. All they will do is add another layer of "stuff" to the code. The underlying topic for this thread is to condense and simplify some very "messy" code.

@OP:
Once you complete the conversion to an array, you should be able to replace your entire switch with a single function. That function could return a bool and use the array and a seatnumber as arguments.

Edited 5 Years Ago by Fbody: n/a

Just a little update:

I've been messing with your code. Using loops, arrays, and functions, I've been able to get it down to about 180 lines. There are some additional formatting changes and condensing that could possibly be done so I don't think it's unreasonable to think you can get it down to about 150 lines.

Edited 5 Years Ago by Fbody: n/a

All your huge switch-statement does is:

get a seat selection X
-> if X is out-of-range or not available, then ask for another seat selection.
-> otherwise, reserve seat X

Your C++ code for doing this should be no more than 5-6 lines of code long, if you just follow the above pseudo-code (and use an array to store the seats as reserved or not). I wish I could just write the code for you, but this is something for you to do on your own. Just a little example on how to use an array:

#include <iostream>

int main() {
  char my_array[9]; //declares a fixed-size array of 9 characters.
  my_array[0] = 'a'; //access the first element of my_array with index 0 (indices start from 0).
  my_array[2] = 'c'; //e.g. this sets the 3rd element to the character 'c'.
  //you can loop through an array with a for-loop:
  for(int i=0;i<9;++i)
    my_array[i] = ' '; //this sets all elements of my_array to the space character.
  //you can also access the elements for printing them:
  for(int i=0;i<9;++i)
    std::cout << my_array[i] << "|"; //prints all elements separated by '|'.
  std::cout << std::endl;

  return 0;
};

In the above, you have all the information you need to turn you thousand-something lines of code to less than a few dozen lines of code.

Yes. It should be possible to use the user's input, in conjunction with the array, to eliminate the switch statement.

How can I do that? Can you show me a code sample for it? please...

How can I do that? Can you show me a code sample for it? please...

mike_2000_17 just posted a code sample.

I'm amazed at how much more difficult you made this for yourself, hopefully if you apply this much effort to studying you can improve your skills.

Something like this pseudocode,
array[600]
for array element 0 3 6, element = [
for array element 2 5 8, element = ]
get user input seatnumber
if seatmap(seatnumber)== 'X'
already taken
else
seatmap(seatnumber) = 'X'

seatmap is an expression that maps user input to the element in the array representing the seat

*hint
[ x ] [ x ] [ x ]
012 345 678

Edited 5 Years Ago by jkoske: n/a

Comments
No need to tear the guy down. He's redoing an old assignment that was required to be done differently at the time.

I'm amazed at how much more difficult you made this for yourself, hopefully if you apply this much effort to studying you can improve your skills.

Was that really necessary? Have you actually read the thread?

How can I do that? Can you show me a code sample for it? please...

All you have to do is use the user's input as the index when accessing the array, provided the requested element is within the valid range for the array.

#include <iostream>

const int ELEMENT_COUNT = 50;                      //a constant to control the array

int main() {
  int userInput
  int myArray[ELEMENT_COUNT] = {0};                //the array

  std::cout << "Please enter an index: ";          //prompt for an element #
  std::cin >> userInput;

  if (userInput >= 0 && userInput < ELEMENT_COUNT) //verify the input is within range
    std::cout << myArray[userInput];               //display the element
  else
    std::cout << "Invalid index." << endl;         //display an error

  return 0;
}

Edited 5 Years Ago by Fbody: n/a

Was that really necessary? Have you actually read the thread?


All you have to do is use the user's input as the index when accessing the array, provided the requested element is within the valid range for the array.

#include <iostream>

const int ELEMENT_COUNT = 50;                      //a constant to control the array

int main() {
  int userInput
  int myArray[ELEMENT_COUNT] = {0};                //the array

  std::cout << "Please enter an index: ";          //prompt for an element #
  std::cin >> userInput;

  if (userInput >= 0 && userInput < ELEMENT_COUNT) //verify the input is within range
    std::cout << myArray[userInput];               //display the element
  else
    std::cout << "Invalid index." << endl;         //display an error

  return 0;
}

sir how do I assign the values of my variables when using arrays? I want something like this to happen

string seatnumber = "1"

this is just an example. In Arrays do I have to assign values to 200 seatnumbers one by one too?

Why the use of strings? Boolean statements would work just as well(better even):

bool seat[200];

And then...

if (seat[input] == 1)
  cout << "Seat Number" << input << "is reserved. Please choose another.";
 else 
   seat[input] = 1

And there you go. Your 500 hundred line case statement is not necessary and you've gone from taking the space of a billion strings to a few boolean variables.

sir how do I assign the values of my variables when using arrays? I want something like this to happen

string seatnumber = "1"

this is just an example. In Arrays do I have to assign values to 200 seatnumbers one by one too?

The syntax of array assignment is as follows:

arrayname[index] = assignment
This article has been dead for over six months. Start a new discussion instead.