#include <iostream>
using namespace std;
void main()
{
int n,k,l;
int i=1,j=6;
int a[5]={0,0,0,0,0};
int b[5]={0,0,0,0,0};
loop0:cout<<"Please type 1 for First Class "<<endl;
cout<<"Please type 2 for Economy "<<endl;
cin>>n;
if (n==1){
loop1:if(i<=5){
cout<<"First Class. Your number is "<<i<<endl;
i=i+1;
}
else {
cout<<"First Class is full. Do you want Economy Seat? Please type 1 for YES,type 2 for NO<<endl;
cin>>k;
if(k==1){
if(j>10){cout<<"Sorry, Economy Seat is full too. Next flight leaves in 3 hours."<<endl;}
else {goto loop2;}
}
if(k==2){cout<<"Next flight leaves in 3 hours."<<endl;}
}
if(n==2){
loop2:if(j<=10){cout<<"Economy. Your number is "<<j<<endl;
j=j+1;}
else {
cout<<"Economy is full. Do you want First Class Seat? Please type 1 for YES, type 2 for NO<<endl;
cin>>l;
if(l==1){
if(k>5){cout<<"Sorry, Economy Seat is full too. Next flight leaves in 3 hours."<<endl;}
else {goto loop1;}
}
if(l==2){cout<<"Next flight leaves in 3 hours."<<endl;}
}
}
if(i<=4||j<=9)goto loop0;
}
编译后显示错误:
\VC++6.0\VisualC++6.0简体中文绿色版\Microsoft Visual Studio\Common\MSDev98\Bin\Cpp1.cpp(18) : error C2001: newline in constant
D:\VC++6.0\VisualC++6.0简体中文绿色版\Microsoft Visual Studio\Common\MSDev98\Bin\Cpp1.cpp(19) : error C2146: syntax error : missing ';' before identifier 'cin'
D:\VC++6.0\VisualC++6.0简体中文绿色版\Microsoft Visual Studio\Common\MSDev98\Bin\Cpp1.cpp(31) : error C2001: newline in constant
D:\VC++6.0\VisualC++6.0简体中文绿色版\Microsoft Visual Studio\Common\MSDev98\Bin\Cpp1.cpp(32) : error C2146: syntax error : missing ';' before identifier 'cin'
D:\VC++6.0\VisualC++6.0简体中文绿色版\Microsoft Visual Studio\Common\MSDev98\Bin\Cpp1.cpp(45) : fatal error C1004: unexpected end of file found