#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;
}
Моя ошибка: ошибка C2143: синтаксическая ошибка: отсутствует ';'перед '{', который находится здесь: else (seat_row> row7);{int row7;cout << "Для вашей информации, это раздел для курящих