第一范文网 - 专业文章范例文档资料分享平台

数据结构课程设计《飞机订票系统》

来源:用户分享 时间:2025/8/9 4:27:17 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

五、源代码

#include #include #include #include #include

#define MAXSIZE 5 /*定义航线数量,可修改*/

typedef struct wat_ros /*单链队列存储等候替补的客户信息*/ { char name[10]; /*姓名*/ int req_amt; /*订票量*/

struct wat_ros *next;

}qnode,*qptr;

typedef struct pqueue /*等候替补的客户名单*/ { qptr front; /*等候替补客户名单域的队头指针*/ qptr rear; /*等候替补客户名单域的队尾指针*/

}linkqueue;

typedef struct ord_ros /*乘员名单*/ { char name[10]; /*客户姓名*/ int ord_amt; /*订票量*/ int grade;

/*舱位等级*/

struct ord_ros *next;

}linklist;

struct airline { char ter_name[10]; /*抵达城市*/ char air_num[10]; /*航班号*/ char time[10]; /*飞机时间*/

char pri[7]; /*票价*/

第 11 页

int tkt_amt; /*乘员定额*/ int tkt_sur; /*余票量*/

linklist *order; /*乘员名单域,指向乘员名单链表的头指针*/

linkqueue wait; /*等候替补的客户名单域,分别指向排队等候名单队头队尾的

指针*/ }lineinfo; struct airline *start;

void display(struct airline *info) /*打印每条航线的基本信息*/ { }

void list() /*打印全部航线信息*/ { }

void search() /*根据客户提出的终点站名输出航线信息*/ {

printf(\

nfo->pri,info->tkt_amt,info->tkt_sur);

struct airline *info; int i=0; info=start;

printf(\终点站名\\t航班号\\t飞行时间\\t票价\\t乘员定额\\t余票量\\n\while(i

printf(\

display(info); /*调用display函数来输出*/ info++; i++;

struct airline *info,*find();

char name[10]; /*要抵达的城市名称*/ int i=0; info=start;

第 12 页

printf(\请输入要抵达城市的名称:\scanf(\while(iter_name)) /*有该站名strcmp则返回,if(!0)即break*/ { break;

} info++; i++;

}

if(i>=MAXSIZE) /*没有匹配的航线*/ { printf(\对不起,没有这条航线!\\n\

} else { printf(\终点站名\\t航班号\\t飞行时间\\t票价\\t乘员定额\\t余票量\\n\ display(info); /*调用display函数输出航线信息*/ }

}

struct airline *find() / *根据系统提出的航班号查询并以指针形式返回*/ { struct airline *info;

char number[10]; /*查询的航班号*/ int i=0; info=start;

printf(\请输入航班号:\ scanf(\ while(iair_num)) /*有匹配航班*/ { return info;

}

第 13 页

}

info++; i++;

} /*无匹配航班*/ printf(\对不起,没有这条航线!\\n\return NULL;

void prtlink() /*打印订票乘员名单域的客户名单信息*/ { }

linklist *insertlink(linklist *head,int amount,char name[],int grade) /*增加订票乘员名单域的客户信息*/ {

linklist *p; struct airline *info; info=find(); p=info->order;

if(p!=NULL) /*按顺序输出客户信息链表*/ {

printf(\客户姓名 订票数额 舱位等级\\n\while(p) { }

printf(\p=p->next;

}

else /*没有人订这个航班*/

printf(\该航线没有客户信息!\\n\

linklist *p1,*new1; p1=head;

new1=(linklist*)malloc(sizeof(linklist));

if(!new1) /*存储空间不足*/ { }

第 14 页

printf(\return NULL;

搜索更多关于: 数据结构课程设计《飞机订票系统》 的文档
数据结构课程设计《飞机订票系统》.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c3zvrq8sote0088t3x4ji0cqsi0v0qh00p6b_4.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top