教学文库网 - 权威文档分享云平台
您的当前位置:首页 > 精品文档 > 政务民生 >

数据结构课程报告 机场订票

来源:网络收集 时间:2026-08-31
导读: 数据结构课程设计的报告 航空客运订票系统 程序要求: 1、问题描述 航空客运订票的业务活动包括:查询航线、客票预订和办理退票等。设计一个航空客运订票系统,以使上述业务可以借助计算机完成。 2、要求 1)每条航线所涉及的信息有:终点站名、航班号、飞机

数据结构课程设计的报告

航空客运订票系统

程序要求:

1、问题描述

航空客运订票的业务活动包括:查询航线、客票预订和办理退票等。设计一个航空客运订票系统,以使上述业务可以借助计算机完成。

2、要求

1)每条航线所涉及的信息有:终点站名、航班号、飞机号、飞行周日(星期几)、乘员定额、余票量、已订票的客户名单(包括名字、订票量、舱位等级1、2、3)以及等候替补的客户名单;

2)系统实现的功能如下:

通过此系统可以实现如下功能:

录入:可以录入航班情况(数据可以存储在一个数据文件中,数据结构、具体数据自定)

查询:可以查询某个航线的情况(如,输入航班号,查询起降时间,起飞抵达城市,航班票价,票价折扣,确定航班是否满仓);可以输入起飞抵达城市,查询飞机航班情况;

订票:(订票情况可以存在一个数据文件中,结构自己设定)可以订票,如果该航班已经无票,可以提供相关可选择航班;

退票:可退票,退票后修改相关数据文件;客户资料有姓名,证件号,订票数量及航班情况,订单要有编号。

修改航班信息:当航班信息改变可以修改航班数据文件

存储结构:航线的所有信息存储在一个结构体中,增加,查询,订票,退票等操作按队列的操作来实现。

数据结构课程设计的报告

数据结构课程设计的报告

详细代码:

#include <iostream.h>

#include <stdio.h>

#include <string.h>

#include <conio.h>

#define m 4 //3架飞机

#define n 5 //每架飞机5张票struct node

{ char name[21];

char id[21];

int seat,plane,date;

node *next,*pre;

};

struct wait

{

char name[21];

char id[21];

char phone[8];

int seat,plane,date,count;

wait *next,*pre;

};

struct piao

{

int seat[n+1];

};

void makenull();

void makenull_piao();

void makenull_information();

void list_menu();

void list_piao();

void makenull_wait();

void list_information();

void plane_information(node *head);

void book();

void add_information(node *head,int x,int y); void add_wait(int x,int y);

void search_delete(int x);

void write_to_file();

void show_wait();

bool comp(node *x,node*y);

数据结构课程设计的报告

node *head1,*head2,*head3,*q;

wait *wait_head,*wait_end;

char c;

piao a[m];

void main()

{

makenull();

do

{ list_menu();

cout<<endl<<"choose an operation: ";

cin>>c;

if (c!='6')

switch(c)

{

case '0' : show_wait();break;

case '1' : {list_piao();book();}break;

case '2' : search_delete(1);break;

case '3' : list_piao();break;

case '4' : list_information();break;

case '5' : search_delete(0);break;

default : break;

}

}while(c!='6');

cout<<"Exit System ";

}

void makenull()

{

makenull_piao();

makenull_information();

makenull_wait();

}

void list_menu()

{ cout<<endl<<"";

cout<<endl<<" 菜单";

cout<<endl<<" ************************";

cout<<endl<<" * 0 . 查看排队情况*";

cout<<endl<<" * 1 . 订票*";

cout<<endl<<" * 2 . 退票*";

cout<<endl<<" * 3 . 查看剩余票*";

cout<<endl<<" * 4 . 查看飞机信息*";

cout<<endl<<" * 5 . 查看乘客信息*";

cout<<endl<<" * 6 . 退出*";

cout<<endl<<" ************************";

cout<<endl<<"";

数据结构课程设计的报告

}

void makenull_piao()

{

FILE *fp;

int i;

if((fp=fopen("piao.dat","r")) == NULL )

{

fp=fopen("piao.dat","w");

for (i=1;i<=m-1;i++)

fwrite(&a[i],sizeof(piao),1,fp);

fclose(fp);

fp=fopen("piao.dat","r");

}

for(i=1;i<=m-1;i++)

fread(&a[i],sizeof(piao),1,fp);

fclose(fp);

}

void makenull_information()

{

node *r;

FILE *fp;

int i,j,sum;

sum=a[1].seat[0]+a[2].seat[0]+a[3].seat[0];

fp=fopen("information.dat","r");

head1=new node;

head2=new node;

head3=new node;

head1->pre=NULL;

head1->next=NULL;

head2->pre=NULL;

head2->next=NULL;

head3->pre=NULL;

head3->next=NULL;

q=head1;

for(i=1;i<=sum;i++)

{

j=0;

r=new node;

fread(r,sizeof(node),1,fp);

q->next=r;

r->pre=q;

r->next=NULL;

q=q->next;

fclose(fp);

数据结构课程设计的报告

if(i==a[1].seat[0]+1) {

head2->next=q;

q->pre->next=NULL;

q->pre=head2;

}

if(i==a[1].seat[0]+a[2].seat[0]+1) {

head3->next=q;

q->pre->next=NULL;

q->pre=head3;

}

}

}

void makenull_wait()

{

wait *tempw;

FILE *fp;

tempw=new wait;

int i;

if((fp=fopen("wait.txt","r")) ==NULL )

{

fp=fopen("wait.txt","w");

fclose(fp);

}

wait_end=new wait;

wait_head=new wait;

wait_end->next=NULL;

wait_end->pre=NULL;

wait_head=wait_end;

wait_head->count=0;

fp=fopen("wait.txt","r");

fread(wait_head,sizeof(wait),1,fp);

for(i=1;i<=wait_head->count;i++)

{

fread(tempw,sizeof(wait),1,fp);

wait_end->next=tempw;

tempw->pre=wait_end;

tempw->next=NULL;

wait_end=tempw;

}

}

void list_piao()

{

int i,j;

for(i=1;i<=m-1;i++)

数据 …… 此处隐藏:6335字,全部文档内容请下载后查看。喜欢就下载吧 ……

数据结构课程报告 机场订票.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.jiaowen.net/wendang/976980.html(转载请注明文章来源)
Copyright © 2020-2025 教文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:78024566 邮箱:78024566@qq.com
苏ICP备19068818号-2
Top
× 游客快捷下载通道(下载后可以自由复制和排版)
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能出现无法下载或内容有问题,请联系客服协助您处理。
× 常见问题(客服时间:周一到周五 9:30-18:00)