ImageVerifierCode 换一换
格式:DOCX , 页数:10 ,大小:17.38KB ,
资源ID:6023273      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bingdoc.com/d-6023273.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(一个简单的火车票售票管理系统Word格式.docx)为本站会员(b****1)主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(发送邮件至service@bingdoc.com或直接QQ联系客服),我们立即给予删除!

一个简单的火车票售票管理系统Word格式.docx

1、/按购票日期搜索(限定某车次)void search_date_all(TNODE *,TIME);/按购票日期搜索(所有车次)void print_c(CNODE *);/输出售票纪录(单张) void print_c_all(CNODE *);/输出售票纪录(批量) TNODE *root=NULL; void main()int i,func,no,ok; TNODE *t; CNODE *c; TIME d; printf(nnn);for(i=0;in); printf(nt 1.增加新的车次); printf(nt 2.取消车次); printf(nt 3.返回上级菜单n); 4

2、/ 18 create();printf(n售票信息更新成功!nn); break;case 2:del();break; case 3:main(); default:printf(n错误功能号输入有误!请重新输入!);break; case 2:printf(nn售票记录管理1.增加新的售票记录); printf(nt 2.退票); 5 / 18 t=search();if(t!=NULL) t-head=insert_c_more(t-head);printf(需要退票的票号:scanf(%d,&no);t-head=del_c(t-head,search_c(t-head,no);ca

3、se 3: 6 / 18 printf(n错误功能号输入有误!printf(nn售票记录查询 printf(nt 1.按票号搜索);2.按购票者证件号搜索);3.按购票日期搜索);4.返回上级菜单n); if(t!=NULL) 7 / 18 printf(n请输入您所要查询的票号: c=search_c(t-head,no);if(c=NULL)printf(错误没有该票号的纪录!该票还未售出或为废票!自动返回上级菜单n.); printf(n请输入您所要查询的购票者证件号: search_c_id_all(root,no);printf(搜索完毕! do printf(n请输入您所要查询的日

4、期(格式: yy-mm-dd):scanf(%d-%d-%d,&d.x,&d.y,&d.z); if(d.y0) 8 / 18 if(d.y=1|d.y=3|d.y=5|d.y=7|d.y=8|d.y=10|d.y=12)if(d.z0) ok=1;else if(d.z=2) if(d.z是,0-否):if(ok) search_date(search()-head,d); else search_date_all(root,d);case 4: printf(nn售票记录一览 printf(nt 1.仅浏览车次); 9 / 18 2.指定车次已售票记录);3.所有车次已售票记录); pri

5、ntf(nt 4.测试:先序遍历车次);5.返回上级菜单n);printf(n+仅浏览车次n);if(root=NULL) printf(错误无车次纪录! elseinorder(root);printf(n); break;printf(n+指定车次已售票记录n); 10 / 18 =NULL) print_c_all(t-printf(n+所有车次已售票记录n); if(root=NULL) printf(错误无车次纪录! elseinorder_all(root); case 4:printf(n+测试:先序遍历车次n); elsepreorder(root);case 5:exit (

6、0);main();void 11 / 18 inorder_all(TNODE *ptr)if(ptr!=NULL)inorder_all(ptr-lchild); printf(%d: n,ptr-data); print_c_all(ptr-inorder_all(ptr-rchild); void inorder(TNODE *ptr)if(ptr!=NULL)inorder(ptr- printf(%dt,ptr- inorder(ptr-void preorder(TNODE *ptr)if(ptr!=NULL)printf(%dt ,ptr-preorder(ptr- void

7、print_c(CNODE *tkt) if(tkt!=NULL) printf(t%dt%dt%d-%d-%dn,tkt-no,tkt-id,tkt-date.x,tkt-date.y,tkt-date.z);void print_c_all(CNODE *head) int i=0,j=0;if(head=NULL)printf(n记录为空!return; for(i=0;printf(nNOt票号t购票者证件号t购票日期(年-月-日)n);i+) printf(-); for(j=0;head!=NULL;j+) 12 / 18 printf(n%d,j); print_c(head);

8、head=head-next;printf(n); printf(n总计%d条记录n,j);void create()int n,i; int kMAX;printf(n您所希望增加车次的数量:n);n;i+) printf(新增第%d列车次: ,i+1);ki);for(i=0;i+) insert(ki);void insert(int m)TNODE *p1,*p2; if(root=NULL)root=(TNODE *)malloc(sizeof(TNODE); root-data=m;root-lchild=root-rchild=NULL;head=NULL;else p1=roo

9、t;while(m!=p1-data)if(mdata)&(p1-lchild!=NULL)p1=p1-lchild;else if(mrchild!rchild; 13 / 18 else if(mp2-lchild=p2- p1-lchild=p2;else if(mrchild=NULL)p2=(TNODE *)malloc(sizeof(TNODE);rchild=p2; return;printf(n错误未能成功增加车次%d,车次号%d已存在!,m,m);TNODE *search() int key; TNODE *p; p=root;printf(n输入您所要查找的车次编号:ke

10、y);while(p!=NULL&p-data!=key) 14 / 18 if(keyelse if(keyif(p=NULL) printf(n该车次不存在!return(p);void del() TNODE *p1,*p2,*p3,*temp; p1=p2=root; p3=temp=NULL;printf(n请输入您想要取消的车次编号:while(p2!=key) if(keyp2=p1-if(p2=NULL)printf(n错误该车次不存在!返回上级菜单n.);else if(p2-lchild=NULL&rchild=NULL)if(p1-lchild=p2) p1-lchild

11、=NULL;if(p1-rchild=p2) p1- temp=p2;if(root=p2) temp=root;root=NULL;else if(p2-rchild=NULL) temp=p2-data=temp-data; 15 / 18 lchild=temp-rchild=temp-else if(p2-lchild=NULL) temp=p2-else p3=p2;temp=p2-while(temp-=NULL)p3=temp;temp=temp- p2-if(p3=p2) p3- else p3- free(temp);printf(车次%d已取消!nn,key);CNODE

12、*insert_c(CNODE *head)CNODE *k,*p;k=(CNODE *)malloc(sizeof(CNODE);printf(n车票编号:k- p=search_c(head,k-if(p!=NULL) printf(n错误该票已被购买!请重新选择! 16 / 18 while(p!=NULL); printf(购票者证件号:id); printf(购票日期(格式:date.x,&date.y,& k-next=head; head=k;return(head);CNODE *insert_c_more(CNODE *head) int n,i;printf(n请输入批量新

13、增售票记录数:i+) head=insert_c(head); printf(n售票记录更新成功!CNODE *search_c(CNODE *head,int id) CNODE *temp,*s; s=temp=head; 17 / 18 while(temp!temp-id!=id)s=temp; print_c(temp);if(temp!=NULL) return(s);else return NULL;void search_c_id(CNODE *head,int id) CNODE *s,*head_s; s=head_s=NULL;if(head=NULL) printf(无

14、该证件号纪录! while(head!=NULL) if(head-id=id) s=(CNODE *)malloc(sizeof(CNODE);s-no=head-no;id=head-id;date=head-date;next=head_s;head_s=s;head=head-print_c_all(head_s);void search_c_id_all(TNODE *ptr,int id) if(ptr!search_c_id_all(ptr-lchild,id); printf(n车次: %dn,ptr- search_c_id(ptr-head,id); search_c_id

15、_all(ptr-rchild,id); void search_date(CNODE *head,TIME t) CNODE *s,*head_s; 18 / 18 =NULL) if(t.x=head-date.x) if(t.y=head-date.y) if(t.z=head-date.z)s=(CNODE *)malloc(sizeof(CNODE); s-void search_date_all(TNODE *ptr,TIME t) search_date_all(ptr-lchild,t); search_date(ptr-head,t); search_date_all(ptr-rchild,t);CNODE *del_c(CNODE *head,CNODE *p) CNODE *temp;if(p=NULL) printf(错误该票未售出或为废票!else if(p=head)head=NULL;free(p);else temp=p- p-next=temp- free(temp);return(head);

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2