IM A NEWBIE TO FILES SO PLZ DO NOT MAKE IT DIFFICULT! #include #include #include
ID: 3626349 • Letter: I
Question
IM A NEWBIE TO FILES SO PLZ DO NOT MAKE IT DIFFICULT!
#include
#include
#include
#include
void main()
{
char Egypt[30][10],US[30][10],UK[30][10];
char choise='y';
int choice;
int row;
int column;
int password;
int destinationChoice;
char name[10];
int role;
for(int i=0;i<30;i++) //Initializing all seats to EMPTY
{
for(int j=0;j<10;j++)
{Egypt[i][j]='E';
US[i][j]='E';
UK[i][j]='E';}
}
while(choise=='y')
{
cout<<"Press 1 for ADMIN's menu or 2 for USER's menu ";
cin>>role;
cout<{
if(role==1)
{
{while(choise=='y')
{
cout<<" "WELCOME TO ADMIN'S MENU "{
cout<<"Please enter the PASSWORD">password;
if(password==10)
{
cout<<" 1 to see all the seats "else
{
cout<<"YOU HAVE ENTERED AN INVALID PASSWORD"}
cin>>choice;
cout{case 1:
{
do
{
cout<<"Enter destination 1 to Egypt 2 to US 3 to UK 4 to back menu">destinationChoice;
switch(destinationChoice)
{
case 1:
for(int m=0;m<30;m++)
{
for(int n=0; n<10; n++)
{coutcase 2:
for(int m=0;m<30;m++)
{
for(int n=0; n<10; n++)
{coutcase 3:
for(int m=0;m<30;m++)
{
for(int n=0; n<10; n++)
{cout0));}
break;
case 2:
{ do
{
cout<<"Enter destination 1 to Egypt 2 to US 3 to UK 4 to back menu">destinationChoice;
switch(destinationChoice)
{
case 1:
for(int o=0; o<30;o++)
{
for(int p=0;p<10;p++)
{
if(Egypt[o][p]=='B')
{cout<}
coutcase 2:
for(int o=0; o<30;o++)
{
for(int p=0;p<10;p++)
{
if(US[o][p]=='B')
{cout<}
coutcase 3:
for(int o=0; o<30;o++)
{
for(int p=0;p<10;p++)
{
if(UK[o][p]=='B')
{cout<}
cout<}}while(destinationChoice<4 && destinationChoice>0);}
break;
case 3:
do
{
cout<<"Enter destination 1 to Egypt 2 to US 3 to UK 4 to back menu">destinationChoice;
switch(destinationChoice)
{
case 1:
{for(int q=0;q<30;q++)
for(int l=0;l<10;l++)
{if(Egypt[q][l]=='E')
{coutcase 2:
{for(int q=0;q<30;q++)
for(int l=0;l<10;l++)
{if(US[q][l]=='E')
{coutcase 3:
{for(int q=0;q<30;q++)
for(int l=0;l<10;l++)
{if(UK[q][l]=='E')
{cout}while(destinationChoice<4 &&destinationChoice>0);
break;
case 4:
cout<<"Enter destination 1 to Egypt 2 to US 3 to UK ">destinationChoice;
cout<<"Please enter the row of seat ";
cin>>row;
row=row-1;
cout<<"Please enter the column of seat ";
cin>>column;
column=column-1;
switch(destinationChoice)
{
case 1:
if(Egypt[row][column]=='B')
{Egypt[row][column]='E';
cout<<"The reserved seat is changed to EMPTY"{cout<<"The given seat is already EMPTY"
case 2:
if(US[row][column]=='B')
{US[row][column]='E';
cout<<"The reserved seat is changed to EMPTY"{cout<<"The given seat is already EMPTY"
case 3:
if(UK[row][column]=='B')
{UK[row][column]='E';
cout<<"The reserved seat is changed to EMPTY"{cout<<"The given seat is already EMPTY"}
cout<<"Do you want to repeat the menu press Y or N ";
cin>>choise;}}}}
if(role==2)
{
char choise='y';
while(choise=='y')
{
cout<<" "WELCOME TO PIA HELP LINE SIR" ">name;
cout<<" Now press 6 for viewing all the seats in that flight ">choice;
coutswitch(choice)
{
case 6:
{if(strcmp(name,"Egypt")==0)
{
for(m=0;m<30;m++)
{
for(int n=0; n<10; n++)
{
cout{
for(m=0;m<30;m++)
{
for(int n=0; n<10; n++)
{
cout{
for(m=0;m<30;m++)
{
for(int n=0; n<10; n++)
{
coutcout<<"Invalid destination"
case 7:
{cout<<"PLease enter row number ";
cin>>row;
row=row-1;
cout<<"Please enter he column number ";
cin>>column;
column=column-1;
cout{
if(Egypt[row][column]=='B')
{cout<<"Sorry the seat is already BOOKED"}
else
{Egypt[row][column]='B';
cout<<"Your seat is BOOKED enjoy the flight"<}
else if(strcmp(name,"US")==0)
{
if(US[row][column]=='B')
{cout<<"Sorry the seat is already BOOKED"}
else
{US[row][column]='B';
cout<<"Your seat is BOOKED enjoy the flight"<}
else if(strcmp(name,"UK")==0)
{
if(UK[row][column]=='B')
{cout<<"Sorry the seat is already BOOKED"}
else
{UK[row][column]='B';
cout<<"Your seat is BOOKED enjoy the flight"<}
else
cout<<"Invalid destination"}}
cout<<"Do you want to repeat the menu press Y or N ";
cin>>choise;}}
cout<<"Do you want to repeat this program press Y or N ";
cin>>choise;}
}
}
Explanation / Answer
Sorry for the errors i will repost it