#include <iostream>
using namespace std;
int main()
{
int seat[10] = {0};
char str[5];
int type;
int first_index = 0;
int economy_index = 5;
while(1)
{
cout<<"Input type[first = 1 , economy = 2] : ";
cin>>type;
if(type == 1)
{
if(first_index > 4)
{
cout<<"Full !!! Want you another type? [yes or no]";
cin>>str;
if(strcmp("yes",str)==0)
{
seat[economy_index] = 1;
economy_index++;
cout<<"First : "<<first_index<<endl;
cout<<"Economy : "<<economy_index-5<<endl;
if(seat[4]==1 && seat[9] ==1)
{
cout<<"Next flight leaves 3 hours"<<endl;;
break;
}
continue;
}
else if(strcmp("no",str)==0)
{
cout<<"Next flight leaves 3 hours"<<endl;;
break;
}
else
continue;
}
seat[first_index] = 1;
first_index++;
}
else if(type == 2)
{
if(economy_index > 9)
{
cout<<"Full !!! Want you another type? [yes or no]";
cin>>str;
if(strcmp("yes",str)==0)
{
seat[first_index] = 1;
first_index++;
cout<<"First : "<<first_index<<endl;
cout<<"Economy : "<<economy_index-5<<endl;
if(seat[4]==1 && seat[9] ==1)
{
cout<<"Next flight leaves 3 hours"<<endl;;
break;
}
continue;
}
else if(strcmp("no",str)==0)
{
cout<<"Next flight leaves 3 hours"<<endl;;
break;
}
else
continue;
}
seat[economy_index] = 1;
economy_index++;
}
else
cout<<"Error Type";
if(seat[4]==1 && seat[9] ==1)
{
cout<<"First : "<<first_index<<endl;
cout<<"Economy : "<<economy_index-5<<endl;
cout<<"Next flight leaves 3 hours"<<endl;;
break;
}
cout<<"First : "<<first_index<<endl;
cout<<"Economy : "<<economy_index-5<<endl;
}
return 0;
}