?? test05.cpp
字號:
// test05.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "iostream"
using namespace std;
int main(int argc, char* argv[])
{
int i,j,k,m,p,num,a[5],b[5];
char c;
for(i=0;i<5;i++)
{
a[i]=0;
b[i]=0;
}
for(j=0;j<=10;j++)
{
cout<<"please type 1 for \"smoking\""<<"\n";
cout<<"please type 2 for \"nonsmoking\""<<"\n";
cin>>num;
if(num==1)
{
for(k=0;k<5;k++)
{
if(a[k]==0)
{
a[k]=1;
cout<<"your number is: "<<k+1<<"\n";
cout<<"you are in \"smoking\""<<"\n"<<"\n";
break;
}
if(a[4]==1)
{
cout<<"there is no seat in \"smoking\""<<"\n";
cout<<"if you want \"nonsmoking\",please type \'y\';otherwise type \'n\'"<<"\n";
cin>>c;
if(c=='y')
{
for(m=0;m<5;m++)
{
if(b[m]==0)
{
b[m]=1;
cout<<"your number is: "<<m+6<<"\n";
cout<<"you are in \"nonsmoking\""<<"\n"<<"\n";
break;
}
if(b[4]==1)
{
cout<<"there is no seat for you"<<"\n"<<"\n";
}
}
}
else
{
cout<<"Next flight leaves 6 hour."<<"\n"<<"\n";
}
break;
}
}
}
if(num==2)
{
for(p=0;p<6;p++)
{
if(b[p]==0)
{
b[p]=1;
cout<<"your number is "<<p+6<<"\n";
cout<<"you are in \"nonsmoking\""<<"\n"<<"\n";
break;
}
if(b[4]==1)
{
cout<<"there is no seat for you "<<"\n"<<"\n";
break;
}
}
}
}
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -