Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Handmade Character Soft Toy Bluey Bingo
anil1961
Updated:
Monday at 3:55 PM
Colombo
Dahua POE Switch 8 Ports (DH-PFS3010-8ET-65)
hashaz2012
Updated:
Monday at 11:56 AM
Ad icon
Singapore V2Ray VPN for Tunneling
hu KANNA
Updated:
Friday at 10:01 AM
Dating Website & Online Chat Room
hotvideo
Updated:
Thursday at 9:25 PM
DJI Mini 4 Pro Drone Combo Plus
Hawaka
Updated:
Thursday at 12:21 PM
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Help
C++ Help
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="Ashhab" data-source="post: 14130918" data-attributes="member: 161448"><p>Machanla C++ eke Airplane Seat Reservation System eka haduwa .</p><p>Okkoma wada but pody aulak thiyenawa .. System eka run wenakota error ekak enawa variable ekak initiate karannathuwa use wenawa kiyala ..</p><p></p><p>menna coding eka </p><p></p><p>#include<iostream></p><p>using namespace std;</p><p>int main()</p><p>{</p><p>char res[13][6];</p><p>int i,j;</p><p>int choices=0;</p><p></p><p>// Declaration of all the variable.</p><p>int row0,row1=0,row2=0,row7,row8;</p><p>int class_choices=0;</p><p></p><p>for(i=0;i<13;i++)</p><p> for(j=0;j<6;j++)</p><p> res<em>[j]='*';</em></p><p><em></em></p><p><em>do</em></p><p><em>{</em></p><p><em> cout<<"Type of service provided. "<<endl;</em></p><p><em> cout<<"1. To enter your ticket type."<<endl;</em></p><p><em> cout<<"2. To display full reservation status."<<endl;</em></p><p><em> cout<<"3. Exit."<<endl<<endl;</em></p><p><em> cout<<"Enter your choice : ";</em></p><p><em> cin>>choices;</em></p><p><em> switch(choices)</em></p><p><em> {</em></p><p><em> // Type of class provided.</em></p><p><em> case 1:</em></p><p><em> cout<<endl<<"1. First Class"<<endl;</em></p><p><em> cout<<"2. Economy Class"<<endl;</em></p><p><em> cout<<"Enter your choice : ";</em></p><p><em> cin>>class_choices;</em></p><p><em> switch(class_choices)</em></p><p><em> {</em></p><p><em> // First Class.</em></p><p><em> case 1:</em></p><p><em> cout<<endl<<"Class specified by you : First Class";</em></p><p><em> row1=0;</em></p><p><em> row2=1;</em></p><p><em> break;</em></p><p><em></em></p><p><em> // Economy Class.</em></p><p><em> case 2:</em></p><p><em> cout<<endl<<"Class specified by you : Economy Class";</em></p><p><em> row0;</em></p><p><em> row1=2;</em></p><p><em> row2=12;</em></p><p><em> row7;</em></p><p><em> row8;</em></p><p><em> break;</em></p><p><em> // To indicate the user made a wrong choice.</em></p><p><em> default:</em></p><p><em> cout<<"WRONG CHOICE";</em></p><p><em> break;</em></p><p><em> }</em></p><p><em> // To indicate that "*" is available seats and "X" is occupied seats.</em></p><p><em> cout<<endl<<"* - Available Seats";</em></p><p><em> cout<<endl<<"X - Occupied Seats";</em></p><p><em> cout<<endl<<"Available seats for you are :: "<<endl;</em></p><p><em> cout<<"\t"<<"A B C D E F"<<endl;</em></p><p><em> for(i=row1;i<=row2;i++)</em></p><p><em> {</em></p><p><em> cout<<"Row "<<i+1;</em></p><p><em> for(j=0;j<6;j++)</em></p><p><em> {</em></p><p><em> cout<<"\t"<<res<em>[j];</em></em></p><p><em><em> }</em></em></p><p><em><em> cout<<endl;</em></em></p><p><em><em> }</em></em></p><p><em><em></em></em></p><p><em><em> int seat_row;</em></em></p><p><em><em> cout<<endl<<"Enter your desired row : Row ";</em></em></p><p><em><em> cin>>seat_row;</em></em></p><p><em><em></em></em></p><p><em><em> // Condition for the non-smoking section.</em></em></p><p><em><em> if (seat_row>row0 && seat_row<row8)</em></em></p><p><em><em> {</em></em></p><p><em><em> int row0,row8;</em></em></p><p><em><em> cout<<"For your information, these are non-smoking section."<<endl;</em></em></p><p><em><em></em></em></p><p><em><em> }</em></em></p><p><em><em></em></em></p><p><em><em> // Condition for the smoking section.</em></em></p><p><em><em> else (seat_row>row7);</em></em></p><p><em><em> {</em></em></p><p><em><em> int row7;</em></em></p><p><em><em> cout<<"For your information, these are smoking section."<<endl; </em></em></p><p><em><em> }</em></em></p><p><em><em></em></em></p><p><em><em> if(seat_row<(row1+1) || seat_row>(row2+1))</em></em></p><p><em><em> {</em></em></p><p><em><em> cout<<"Invalid row selected";</em></em></p><p><em><em> system("pause");</em></em></p><p><em><em> break;</em></em></p><p><em><em> }</em></em></p><p><em><em></em></em></p><p><em><em></em></em></p><p><em><em> int seat;</em></em></p><p><em><em> cout<<endl<<"Enter your desired seat number (1-6) :";</em></em></p><p><em><em> cin>>seat;</em></em></p><p><em><em> if(seat<1 || seat>6)</em></em></p><p><em><em> {</em></em></p><p><em><em> cout<<"Invalid seat selected";</em></em></p><p><em><em> system("pause");</em></em></p><p><em><em> break;</em></em></p><p><em><em> }</em></em></p><p><em><em></em></em></p><p><em><em> if(res[seat_row-1][seat-1]!='X')</em></em></p><p><em><em> {</em></em></p><p><em><em> res[seat_row-1][seat-1]='X';</em></em></p><p><em><em> cout<<endl<<"Reserved";</em></em></p><p><em><em> }</em></em></p><p><em><em> else</em></em></p><p><em><em> {</em></em></p><p><em><em> cout<<endl<<" Owh,no! ! ! This seat is taken.";</em></em></p><p><em><em> break;</em></em></p><p><em><em> }</em></em></p><p><em><em> system("pause");</em></em></p><p><em><em> break;</em></em></p><p><em><em></em></em></p><p><em><em> // To display reservation status.</em></em></p><p><em><em> case 2:</em></em></p><p><em><em> cout<<endl<<"\tA B C D E F"<<endl;</em></em></p><p><em><em> for(i=0;i<13;i++)</em></em></p><p><em><em> {</em></em></p><p><em><em> cout<<"Row "<<i+1;</em></em></p><p><em><em> for(j=0;j<6;j++)</em></em></p><p><em><em> {</em></em></p><p><em><em> cout<<"\t"<<res<em>[j];</em></em></em></p><p><em><em><em> }</em></em></em></p><p><em><em><em> cout<<endl;</em></em></em></p><p><em><em><em> }</em></em></em></p><p><em><em><em></em></em></em></p><p><em><em><em></em></em></em></p><p><em><em><em> system("pause");</em></em></em></p><p><em><em><em></em></em></em></p><p><em><em><em> // To exit.</em></em></em></p><p><em><em><em> case 3:</em></em></em></p><p><em><em><em> break;</em></em></em></p><p><em><em><em> }</em></em></em></p><p><em><em><em>}</em></em></em></p><p><em><em><em>while(choices!=3);</em></em></em></p><p><em><em><em> return 0;</em></em></em></p><p><em><em><em></em></em></em></p><p><em><em><em></em></em></em></p><p><em><em><em>}</em></em></em></p><p><em><em><em></em></em></em></p><p><em><em><em></em></em></em></p><p><em><em><em>pl z help me .</em></em></em></p><p><em><em><em></em></em></em></p><p><em><em><em>thnx</em></em></em></p></blockquote><p></p>
[QUOTE="Ashhab, post: 14130918, member: 161448"] Machanla C++ eke Airplane Seat Reservation System eka haduwa . Okkoma wada but pody aulak thiyenawa .. System eka run wenakota error ekak enawa variable ekak initiate karannathuwa use wenawa kiyala .. menna coding eka #include<iostream> using namespace std; int main() { char res[13][6]; int i,j; int choices=0; // Declaration of all the variable. int row0,row1=0,row2=0,row7,row8; int class_choices=0; for(i=0;i<13;i++) for(j=0;j<6;j++) res[i][j]='*'; do { cout<<"Type of service provided. "<<endl; cout<<"1. To enter your ticket type."<<endl; cout<<"2. To display full reservation status."<<endl; cout<<"3. Exit."<<endl<<endl; cout<<"Enter your choice : "; cin>>choices; switch(choices) { // Type of class provided. case 1: cout<<endl<<"1. First Class"<<endl; cout<<"2. Economy Class"<<endl; cout<<"Enter your choice : "; cin>>class_choices; switch(class_choices) { // First Class. case 1: cout<<endl<<"Class specified by you : First Class"; row1=0; row2=1; break; // Economy Class. case 2: cout<<endl<<"Class specified by you : Economy Class"; row0; row1=2; row2=12; row7; row8; break; // To indicate the user made a wrong choice. default: cout<<"WRONG CHOICE"; break; } // To indicate that "*" is available seats and "X" is occupied seats. cout<<endl<<"* - Available Seats"; cout<<endl<<"X - Occupied Seats"; cout<<endl<<"Available seats for you are :: "<<endl; cout<<"\t"<<"A B C D E F"<<endl; for(i=row1;i<=row2;i++) { cout<<"Row "<<i+1; for(j=0;j<6;j++) { cout<<"\t"<<res[i][j]; } cout<<endl; } int seat_row; cout<<endl<<"Enter your desired row : Row "; cin>>seat_row; // Condition for the non-smoking section. if (seat_row>row0 && seat_row<row8) { int row0,row8; cout<<"For your information, these are non-smoking section."<<endl; } // Condition for the smoking section. else (seat_row>row7); { int row7; cout<<"For your information, these are smoking section."<<endl; } if(seat_row<(row1+1) || seat_row>(row2+1)) { cout<<"Invalid row selected"; system("pause"); break; } int seat; cout<<endl<<"Enter your desired seat number (1-6) :"; cin>>seat; if(seat<1 || seat>6) { cout<<"Invalid seat selected"; system("pause"); break; } if(res[seat_row-1][seat-1]!='X') { res[seat_row-1][seat-1]='X'; cout<<endl<<"Reserved"; } else { cout<<endl<<" Owh,no! ! ! This seat is taken."; break; } system("pause"); break; // To display reservation status. case 2: cout<<endl<<"\tA B C D E F"<<endl; for(i=0;i<13;i++) { cout<<"Row "<<i+1; for(j=0;j<6;j++) { cout<<"\t"<<res[i][j]; } cout<<endl; } system("pause"); // To exit. case 3: break; } } while(choices!=3); return 0; } pl z help me . thnx[/i][/i][/i] [/QUOTE]
Insert quotes…
Verification
Hata thunen beduwama keeyada? (60 bedeema thuna)
Post reply
Top
Bottom