| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2269 人关注过本帖
标题:航空客运订票系统
只看楼主 加入收藏
cyzyh88
Rank: 1
等 级:新手上路
帖 子:34
专家分:0
注 册:2007-5-23
收藏
 问题点数:0 回复次数:1 
航空客运订票系统

航空客运订票系统
【问题描述】
航空客运订票的业务活动包括:查询航线、客票预订和办理退票等。试设计一个航空客运订票系统,以使
上述业务可以借助计算机来完成。
【基本要求】
1.每条航线所涉及的信息有:终点站名、航班号、飞机号、飞行日(星期几)、乘员定额、余票量、已
订票的客户名单(包括姓名、订票量、舱位等级1,2或3)以及等候替补的客户名单(包括姓名、所需票
量);
2.全部数据可以只放在内存中;
3.系统能实现的操作和功能如下:
a)查询航线:
根据旅客提出的终点站名输出下列信息:航班号、飞机号、星期几飞行,最近一天航班的日期和余票额;
b)承办订票业务:
根据客户提出的要求(航班号、订票数额)查询该航班票额情况,若尚有余票,则为客户办理订票手续,
输出座位号;若已满员或余票额少于定票额,则需重新询问客户要求。若需要,可登记排队候补;
c)承办退票业务:
根据客户提供的情况(日期、航班),为客户办理退票手续,然后查询该航班是否有人排队候补,首先询
问排在

搜索更多相关主题的帖子: 订票 客运 航空 系统 
2007-05-25 23:41
康elon
Rank: 2
来 自:西安
等 级:论坛游民
帖 子:179
专家分:24
注 册:2008-4-6
收藏
得分:0 
你看这个行不?
# include"stdio.h"
# include"string.h"
# include"stdlib.h"
# define N 100

char sel1;
char sel2;
int fm=0;
int pm=0;

struct flight
{int flightnum;
int starttime;
int arrivedtime;
char start[10];
char arrived[10];
int portermax;
int money;
int flytime;
char date[10];
}s[N];

struct porter
{char name[10];
char unit[10];
int licencenum;
int ticketdate;
int flightnum;
int sizenum;
}a[N];

void input()
{int i=0;
int num;
int k;
scanf("%d",&num);
while(num==1)
{printf("Please input the new flightnumber:");
scanf("%d",&s[i].flightnum);
printf("Please input the starttime:");
scanf("%d",&s[i].starttime);
printf("Please input the arrivedtime:");
scanf("%d",&s[i].arrivedtime);
printf("Please input the start:");
scanf("%s",s[i].start);
printf("Please input the arrived:");
scanf("%s",s[i].arrived);
printf("Please input the portermax:");
scanf("%d",&s[i].portermax);
printf("Please input the money:");
scanf("%d",&s[i].money);
printf("Please input the flytime:");
scanf("%d",&s[i].flytime);
printf("please input the date");
scanf("%s",s[i].date);
i++;
printf("need to creade another new flight? yes=1 no=other.");
scanf("%d",&num);
};
fm=i;
printf("Return to main menu?(Yes=1)");
scanf("%d",&k);
if (k==1)
main();
}

void findflight()
{ int i;
int j;
int k;
char st[10];
char ar[10];
int sn;
printf("Please input the start:");
scanf("%s",st);
printf("Please input the arrived:");
scanf("%s",ar);
printf(" fltnum start arrived starttime arrtime max money flt date\n");
sn=0;
for(i=0;i<=fm;i++)
{if ((strcmp(st,s[i].start)==0)&&(strcmp(ar,s[i].arrived)==0))
{printf("%7d%10s%10s%10d%10d%5d%6d%4d%5s\n",s[i].flightnum,s[i].start,s[i].arrived,
s[i].starttime,s[i].arrivedtime,s[i].portermax,s[i].money,s[i].flytime,s[i].date);
sn=1;s[i].portermax--;}}
if (sn==0)
{printf("the flight you need is not found!please check it!\n");
printf("Return to main menu?(Yes=1)");
scanf("%d",&k);
if (k==1)
main();}
printf("Please input the name:");
scanf("%s",a[pm].name);
printf("Please input the unit:");
scanf("%s",a[pm].unit);
printf("Please input the licencenum:");
scanf("%d",&a[pm].licencenum);
printf("Please input the ticketdate:");
scanf("%d",&a[pm].ticketdate);
printf("Please input the flightnum:");
scanf("%d",&a[pm].flightnum);
printf("Please input the sizenum:");
scanf("%d",&a[pm].sizenum);
pm=pm+1;
printf("Return to main menu?(Yes=1)");
scanf("%d",&k);
if (k==1)
main();
}
void passticket()
{int i;
int ptfn;
int ptsn;
int dm;
int yn;
int k;
printf("please input the flight num:");
scanf("%d",&ptfn);
printf("please input the size num:");
scanf("%d",&ptsn);
for (i=0;i<=fm;i++)
{if ((s[i].flightnum==ptfn)&&(a[i].sizenum==ptsn))
{dm=i;
s[i].portermax++;
printf("please back the money!\n");}}

printf("would you like to pass the porter?");
printf("yes=1,no=2");
scanf("%d",&yn);
if (yn==1)
{int j;


for (j=dm;j<=pm;j++)
{a[j]=a[j+1];
}
pm=pm-1;
printf("\nthe porter has been delete!\n");}
printf("Return to main menu?(Yes=1)");
scanf("%d",&k);
if (k==1)
main();
}

void findflightzl()
{int fln;
int i;
int j;
printf("please input the flightnum you want to find:");
scanf("%d",&fln);
printf(" fltnum start arrived starttime arrtime max money flt date\n");
for (i=0;i<=pm;i++)
{if (s[i].flightnum==fln)
printf("%7d%10s%10s%10d%10d%5d%6d%4d%5s\n",s[i].flightnum,s[i].start,s[i].arrived,
s[i].starttime,s[i].arrivedtime,s[i].portermax,s[i].money,s[i].flytime,s[i].date);
}
printf("Return to main menu?(Yes=1)");
scanf("%d",&j);
if (j==1)
main();
}

void findbydate()
{char da[10];
int i;
int j;
printf("please input the date you want to find:");
scanf("%s",&da);
printf(" fltnum start arrived starttime arrtime max money flt date\n");
for (i=0;i<=pm;i++)
{if (strcmp(s[i].date,da)==0)
printf("%7d%10s%10s%10d%10d%5d%6d%4d%5s\n",s[i].flightnum,s[i].start,s[i].arrived,
s[i].starttime,s[i].arrivedtime,s[i].portermax,s[i].money,s[i].flytime,s[i].date);
}
printf("Return to main menu?(Yes=1)");
scanf("%d",&j);
if (j==1)
main();
}

void mainmenu();

void newflight()
{ int i=fm;
int k;
printf("Please input the new flightnumber:");
scanf("%d",&s[i].flightnum);
printf("Please input the starttime:");
scanf("%d",&s[i].starttime);
printf("Please input the arrivedtime:");
scanf("%d",&s[i].arrivedtime);
printf("Please input the start:");
scanf("%s",s[i].start);
printf("Please input the arrived:");
scanf("%s",s[i].arrived);
printf("Please input the portermax:");
scanf("%d",&s[i].portermax);
printf("Please input the money:");
scanf("%d",&s[i].money);
printf("Please input the flytime:");
scanf("%d",&s[i].flytime);
printf("please input the date:");
scanf("%s",s[i].date);
fm=fm+1;
printf("Return to main menu?(Yes=1)");
scanf("%d",&k);
if (k==1)
main();
}

void passflight()
{int pfn;
int tm;
int yn;
int i;
int k;
printf("please input the flightnum you need:");
scanf("%d",&pfn);
for (i=0;i<=fm;i++)
{if (s[i].flightnum==pfn)
tm=i;}
printf("would you like to pass the flight?");
printf("yes=1,no=2");
scanf("%d",&yn);
if (yn==1)
{int j;
for (j=tm;j<=fm;j++)
{s[j]=s[j+1];}
fm=fm-1;
printf("the flight has been delete!\n");}
printf("Return to main menu?(Yes=1)");
scanf("%d",&k);
if (k==1)
main();
}
void findflightname()
{
int i;
int j;
char name[10];
printf("please input the name you want to find:");
scanf("%s",name);
printf(" name unit licnum ticdat flinum siznum\n");
for (i=0;i<=pm;i++)
{if (strcmp(a[i].name,name)==0)
printf("%10s%10s%10d%10d%10d%10d\n",a[i].name,a[i].unit,a[i].licencenum,a[i].ticketdate,
a[i].flightnum,a[i].sizenum);}
printf("Return to main menu?(Yes=1)");
scanf("%d",&j);
if (j==1)
main();
}
void find_start_arrived()
{
int i;
int j;
char st[10];
char ar[10];
printf("Please input the start:");
scanf("%s",st);
printf("Please input the arrived:");
scanf("%s",ar);
printf(" fltnum start arrived starttime arrtime max money flt date\n");
for(i=0;i<=fm;i++)
{if ((strcmp(st,s[i].start)==0)&&(strcmp(ar,s[i].arrived)==0))
printf("%7d%10s%10s%10d%10d%5d%6d%4d%5s\n",s[i].flightnum,s[i].start,s[i].arrived,
s[i].starttime,s[i].arrivedtime,s[i].portermax,s[i].money,s[i].flytime,s[i].date);}
printf("Return to main menu?(Yes=1)");
scanf("%d",&j);
if (j==1)
main();
}
void flightmanage();
void findbydate();
void findfly()
{
char find;
system("cls");
printf("\n");
printf("\n");
printf(" **********************************************************************\n");
printf(" * *\n");
printf(" * Flight find *\n");
printf(" * *\n");
printf(" **********************************************************************\n");
printf("\n");
printf("\n");
printf("\n");
printf(" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
printf(" + +\n");
printf(" + Please choose: (input the serial number) +\n");
printf(" + +\n");
printf(" + +\n");
printf(" + 1. Find by flightnum. +\n");
printf(" + +\n");
printf(" + 2. Find by portername. +\n");
printf(" + +\n");
printf(" + 3. Find by datenum. +\n");
printf(" + +\n");
printf(" + 4. Find by start-arrived. +\n");
printf(" + +\n");
printf(" + 5. Return to the mainmenu. +\n");
printf(" + +\n");
printf(" + +\n");
printf(" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
printf("please select:");
scanf("%c",&find);
switch(find)
{
case '1' : findflightzl();break;
case '2' : findflightname();break;
case '3' : findbydate();break;
case '4' : find_start_arrived();break;
case '5' : main();break;
default : break;
}

}


void flightmanage();

void dayflightmanage()
{
int i;
int j;
char day[10];
printf("Please input date:");
scanf("%s",day);
printf(" fltnum start arrived starttime arrtime max money flt date\n");
for(i=0;i<=fm;i++)
{if (strcmp(day,s[i].date)==0)
printf("%7d%10s%10s%10d%10d%5d%6d%4d%5s\n",s[i].flightnum,s[i].start,s[i].arrived,s[i].starttime,s[i].arrivedtime,s[i].portermax,s[i].money,s[i].flytime,s[i].date);
}
printf("Return to main menu?(Yes=1) Return to flightmanage menu?(No=0)");
scanf("%d",&j);
if (j==1)
main();
else
flightmanage();

}

void recentmanage()
{
char stdate[10];
int cha=0;
int i;
int j;
int check=0;
printf("please input startdate:");
scanf("%s",stdate);
printf("\n");
printf(" fltnum start arrived starttime arrtime max money flt date\n");
for(i=0;i<=fm;i++)
if (strcmp(stdate,s[i].date)==0)
{printf("%7d%10s%10s%10d%10d%5d%6d%4d%5s\n",s[i].flightnum,s[i].start,s[i].arrived,
s[i].starttime,s[i].arrivedtime,s[i].portermax,s[i].money,s[i].flytime,s[i].date);
cha=i+1;
check=1;
for(i=cha;i<fm;i++)
{printf("%7d%10s%10s%10d%10d%5d%6d%4d%5s\n",s[i].flightnum,s[i].start,s[i].arrived,
s[i].starttime,s[i].arrivedtime,s[i].portermax,s[i].money,s[i].flytime,s[i].date); }
}
if (check==0)
{printf("can't find any flight!\n");}
printf("Return to main menu?(Yes=1)");
scanf("%d",&j);
if (j==1)
main();
}
 
void mainmenu()
{

system("cls");
printf("\n");
printf("\n");
printf(" **********************************************************************\n");
printf(" * *\n");
printf(" * Welcome to use the system *\n");
printf(" * *\n");
printf(" **********************************************************************\n");
printf("\n");
printf("\n");
printf("\n");
printf(" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
printf(" + +\n");
printf(" + Please choose: (input the serial number) +\n");
printf(" + +\n");
printf(" + +\n");
printf(" + 1. Book ticket(s). +\n");
printf(" + +\n");
printf(" + 2. Return a ticket. +\n");
printf(" + +\n");
printf(" + 3. Scheduled flight manage. +\n");
printf(" + +\n");
printf(" + 4. Get information. +\n");
printf(" + +\n");
printf(" + 5. Save and exit. +\n");
printf(" + +\n");
printf(" + +\n");
printf(" + +\n");
printf(" + +\n");
printf(" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
printf("\n");
printf("\n");
printf("\n");
printf("please select:");
scanf("%c",&sel1);
}

void mainmenu();
void dayflightmanage();
void findflightzl();
void passflight();
void flightmanage()
{

system("cls");
printf("\n");
printf("\n");
printf(" **********************************************************************\n");
printf(" * *\n");
printf(" * Flight manage menu *\n");
printf(" * *\n");
printf(" **********************************************************************\n");
printf("\n");
printf("\n");
printf("\n");
printf(" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
printf(" + +\n");
printf(" + Please choose: (input the serial number) +\n");
printf(" + +\n");
printf(" + +\n");
printf(" + 1. Get base information of Scheduled flight. +\n");
printf(" + +\n");
printf(" + 2. Day fly condition manage. +\n");
printf(" + +\n");
printf(" + 3. Recent fly condition manage. +\n");
printf(" + +\n");
printf(" + 4. insert new flight. +\n");
printf(" + +\n");
printf(" + 5. Delete flight. +\n");
printf(" + +\n");
printf(" + 6. Return main menu. +\n");
printf(" + +\n");
printf(" + +\n");
printf(" + +\n");
printf(" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
printf("\n");
printf("\n");
printf("\n");
printf("please select:");
scanf("%c",&sel2);
switch (sel2)
{
case '1' : findflightzl();break;
case '2' : dayflightmanage();break;
case '3' : recentmanage();break;
case '4' : newflight();break;
case '5' : passflight();break;
case '6' : mainmenu();break;
default : break;
}
}

void filesave()
{int j;
FILE *fp;
if((fp=fopen("flight","wb"))==NULL)
{printf("can't open file!\n");
return;
}
for(j=0;j<fm;j++)
if(fwrite(&s[j],sizeof(struct flight),1,fp)!=1)
printf("file write error!\n");
fclose(fp);
exit(1);
}

main()
{

mainmenu();
switch (sel1)
{
case '1' : findflight();break;
case '2' : passticket();break;
case '3' : flightmanage();break;
case '4' : findfly();break;
case '5' : filesave();break;
default : break;

}
}

我很厉害。。。
2008-05-24 16:02
快速回复:航空客运订票系统
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.030994 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved