利用C++的一个订票系统的开发
一家小型航空公司刚为它的自动顶票系统购买了一台计算机,要求你来编写新系统的程序.要编写一个程序,为该航空公司唯一一架飞机的每次航班分配座位(此机的载容量:10个座位).程序应该显示2选1的菜单---Please type 1 for "first class"和please
type 2 for ECONOMY.如果乘客输入1,程序应该为其分配在头等舱的座位(座位1-5).如果乘客输入2,程序应该为其分配在经济舱的座位(6-10).程序应该打印一张登记牌,表明该用户的座位号及它是在飞机的头等舱还是在经济舱.
使用一个一维数组表示飞机的座位表.数组的所有元素初始化为0,表明所有的座位是空的.当座位被分配时,把对应的数组元素加一,表明这个元素不再是空的了.
程序不应该分配一个已经分配过的座位,当头等舱满员时,程序应该询问用户,是否可以安排在经济舱,(反之亦然).如果可以,就进行适当的座位分配.如果不可以,就打印消息"NEXT FLIGHT "
#include<iostream.h>
#include<time.h>
#include<stdlib.h>
int get();
int main()
{const int i=11;
int a[i]={0,0,0,0,0,0,0,0,0,0,0,};
srand(time(0));
int number;
cout<<ple-------<<endl;
cout<<ple <<endl;
cin>>number;
if(number==1)
a[get()]=1;
cout<<"the first class number:"<<a[get];
if(number==2)
a[5+get()]==1;
cout<<"the Economy"<<a[5+get()];
for(int x=1;x<6;x++;)
if(a[i]==1)
cout<<"can you to Economy"
for(int y=6;y<i;y++)
if(a[y]==1)
cout<<"can you to first class"
return 0;}
int get()
{return rand()%6;}
这个程序不能够实现在分配的问题,大家帮忙看下,怎么实现啊.谢谢`:)