已阅读5页,还剩5页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
票务信息管理程序Ticket-Information-Management-Programm 肖 泓0823020103干璐云0823020102李经纬0823020124 -Gruppenarbeit Von TESSA, VERONIKA,WILLIAM.功能分析Functional Analysis设计一个在太阳星系中穿越的飞船票务信息管理程序,要求实现查询、购买、退订票务等功能;能够储存票务和车次信息;能够实现各种车票信息的添加、查询、修改等操作。Design ticketing information management about a spacecraft through the solar system that requires the realization of query, purchase, unsubscribe from ticketing and other functions;To store information on ticketing and train number;Be able to achieve a ticket information to add, query, modify etc.算法分析Algorithm 1.数据结构Data Structure typedef struct traininfor /*车次结构体*/ char station1010; /*记录车站信息*/ char tnumber20; /*车次号*/ float price; /*车票价格*/ int lnumber; /*生成票量*/ char time20; /*到站时间*/ pemp; struct ticket /*车票信息结构体*/ char buyer10; /*购票人姓名*/ char source30; /*起始站*/ char dest30; /*终点站*/ int bnumber; /*购买的张数*/ ;2.函数定义Function definition Void menu(pemp *pointtr,struct sticket *pointtk)主菜单程序(由 肖泓 编写 -TESSA)Void buy(pemp *pointtr,struct sticket *pointtk)购买车票程序(由 干璐云编写 -VERONIKA)Void returnt(pemp *pointtr,struct sticket *pointtk)退票程序(由 李经纬 编写 -WILLIAM)Void check(pemp *pointtr,struct sticket *pointtk)查看某起始地、目的地的车票信息 (-TESSA)Void show(pemp *pointtr,struct sticket *pointtk)显示车票信息(-VERONIKA) Void exit()推出程序 ()算法设计和编程实验Algorithm design and programming experiments/*ticket.c*/#include#include#define NUM 100typedef struct traininfor char station1010; char tnumber20; float price; int lnumber; char time20;pemp;struct ticket char buyer10; char source30; char dest30; int bnumber;void menu(pemp *pointtr,struct ticket *pointtk); /*菜单显示程序*/void buy(pemp *pointtr,struct ticket *pointtk);void returnt(pemp *pointtr,struct ticket *pointtk);void check(pemp *pointtr,struct ticket *pointtk);void show(pemp *pointtr,struct ticket *pointtk);void exit();void main() pemp traininformationNUM; struct ticket chequeNUM; pemp *pointtr; struct ticket *pointtk; pointtr=traininformation; pointtk=cheque; strcpy(pointtr-station0,水星Mercury); strcpy(pointtr-station1,金星Venus); strcpy(pointtr-station2,火星Mars); strcpy(pointtr-station3,木星Jupiter); strcpy(pointtr-station4,土星Saturnus); strcpy(pointtr-station5,天王星Uranus); strcpy(pointtr-station6,海王星Nepture); strcpy(pointtr-tnumber,Spacecraft); pointtr-price=88.00; pointtr-lnumber=50; strcpy(pointtr-time,2012年12月21日11点22分); pointtk-bnumber=0; menu(pointtr,pointtk);void menu(pemp *pointtr,struct ticket *pointtk) /*菜单显示程序*/ int a; /*选项*/ printf(nnnn -目录-n); printf( 1,查询车票 Check Ticketn); printf( 2,购买车票 Buy Ticketn); printf( 3,退订车票 Return Ticketn); printf( 4,退出程序 Exitn); printf( 请输入选项序号Please enter your Option Number:); scanf(%d,&a); if(a=1) check(pointtr,pointtk); /*按起始地目的地查找*/ menu(pointtr,pointtk); /*显示菜单程序*/ else if(a=2) buy(pointtr,pointtk); /*购买车票*/ else if(a=3) returnt(pointtr,pointtk); /*退订车票*/ else if(a=4) printf(谢谢使用THANK YOU FOR USING); exit(); void show(struct ticket *pointtk,pemp *pointtr) printf(车次Train No.: ); /*依次输出信息*/ printf(Spacecraft); printf(起始地Source-目的地Destination: ); printf(%s-,pointtk-source); printf(%sn,pointtk-dest); printf(到达时间 Arrival time: ,pointtk-source); printf(%sn,pointtr-time); printf(票价Price: ); printf(%10.2fn,pointtr-price); printf(车票数量Lnumber: ); printf(%dn,pointtr-lnumber);void check(pemp *pointtr,struct ticket *pointtk) int i,j,count=0; char sour10; char dest10; printf(请输入起始地Input sour: n); /*输入起始地*/ scanf(%s,sour); printf(请输入目的地Input dest:n); /*输入目的地*/ scanf(%s,dest); for(i=0;istationi,sour)=0) /*查找第一个车站*/ for(j=0;jstationj,dest)=0) /*查找第二个车站*/ strcpy(pointtk-source,pointtr-stationi); /*将车站写入车票结构体*/ strcpy(pointtk-dest,pointtr-stationj); show(pointtk,pointtr); count+; break; if(count=0) printf(无信息No message!n); strcpy(pointtk-source,0); /*没有找到,车站为空*/ strcpy(pointtk-dest,0); return; void buy(pemp *pointtr,struct ticket *pointtk) /*购买车票程序*/ char choice10; /*记录选项*/ int buynumber; printf(请输入您的姓名please enter your name:n); scanf(%s, pointtk-buyer); /*输入名字*/ check(pointtr,pointtk); /*查询是否有相应车票*/ if(strcmp(pointtk-dest,0)=0) /*如果没有,给出提示信息*/ printf(无此站!返回菜单.NO such station!return to menu.n); menu(pointtr,pointtk);else printf(您确定要购买此车票吗Are you sure to buy this ticket?1.是YES 2.否NO); /*确认购买*/ scanf(%s,choice); if(strcmp(choice,1)=0) printf(请输入您要购买的张数Please enter the number of ticket you want to buy:n); /*输入张数*/ scanf(%d,&buynumber); if(buynumberlnumber)-buynumber)=0) printf(购买成功!返回菜单.buying Success! return to menu.n); pointtk-bnumber=buynumber; (pointtr-lnumber)-=buynumber; menu(pointtr,pointtk); else printf(车票已售完或不足,不能购买!返回菜单.Tickets are sold out ,Buy failed! Return to Menu.n); /*若车票不够,给予提示信息*/ menu(pointtr,pointtk); else if(strcmp(choice,2)=0) /*放弃购买*/ printf(放弃购买!返回菜单.! GIVE UP buying! return to menu.n); menu(pointtr,pointtk); else menu(pointtr,pointtk); printf(错误!返回菜单.ERROR! return to menu.n); menu(pointtr,pointtk); void returnt(pemp *pointtr,struct ticket *pointtk) char choice10; /*记录选项*/ printf(您确定退票吗?Return tickets?1.是Yes 2.否No n); /*确认是否退票*/ scanf(%s,choice); if(strcmp(choice,1)=0) printf(退票成功 Return succeed! 返回菜单 Back to menun); pointtr-lnumber+=pointtk-bnumber; /*票数增加*/ menu(pointtr,pointtk); /*返回菜单*/ else if(strcmp(choice,2)=0) printf(放弃退票 Return failed! 返回菜单 Back to menun); menu(pointtr,pointtk); else menu(pointtr,pointtk); printf(错误 Error,返回菜单 Back to menun); menu(pointtr,pointtk); void exit()exit();调试运行Commissioning错误ERROR成功success 结果RESULT小结Summary只通过对这一课题的设计和实现,我们对Micosoft Visual C+环境进行了深一步的了解并认识到,编程时要养成良好的风格,注意相同内容的缩进和对齐。这样做,可以使程序代码出错的情况下,可以快速并且便捷的查找到错误的行,利于很好的修改。不但有助于代码的移植和纠错,也有助于不同小组成员之间的协作。Through the design and implementation of this topic, we have deeply understand the environment of Micosoft Visual C + + and realized that to develop good programming style, pay attention to the same content, indentation and alignment,when designing. This can help you quickly and easily find the wrong line,when the case were made of an error code,and which will help a very good correct.It will not only contribute to the code migration and error correction, but also contribute to the collaboration between team-members. 程序设计主要涉及到了C语言中的结构体、指针及文件操作等内容,只有充分掌握了C语言中的结构体、指针及文件操作等内容,才有可能组织好这些代码,使之符合运算逻辑,得到理想的结果。This program was planned primarily related to the C language structures, pointers, and file operations and other content, only a full grasp of the C language structures, pointers, and file operations and other content, will it be possible to organize the code to conform to operation logic, and get the desired results. 我们想说,编程确实有些辛苦,但苦中也有乐,在这个团队的任务中,一起的工作可以让我们有说有笑,相互帮助,配合默契。对我们而言,知识上的收获重要,精神上的丰收是可喜的。挫折是一份财富,经历是一份拥有。We would like to say, programming does have some hard work, but they can also have fun in this teams task, working together allows us talked and laughed together, and helped each other tacit understanding. For us, gains in knowledge is important, while gain in emotion does also great. Frustration and experience are wealth.回顾起此次课程设计,至今仍感慨颇多自从拿到题目到完成整个编程,从理论到实践,在整整半个月的日子里,使我们体会到了理论与实际相结合是很重要的,只有理论知识是远远不够的,只有把所学的理论知识与实践相结合起来,才能提高自己的实际动手能力和独立思考的能力。在设计过程中遇到问题,可以说是困难重重,毕竟第一次做这样的项目,我们难免会遇到过各种各样的问题,同时在设计的过程中,我们也发现了自己的不足之处,以及发现对一些前面学过的知识理解得不够深刻,掌握得不够牢固。Recalling the process of this curriculum design is still feeling a lot .Since getting the subject to the completion of the programming, from theory to practice, in the whole half-month, we understand the importantce of combination of theory and practice. The theoretical know
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025审计招聘笔试题及答案
- 2025商务拓展经理校招真题及答案
- 2025人事专员招聘题库及答案
- 2025【林地承包经营权转让合同】林地承包经营权
- 2025秋招:智能制造技术岗笔试题及答案
- 2025年中考甘肃历史真题及答案
- 2025年贵阳色彩联考真题及答案
- 2025年杭州市存量房屋买卖合同范本
- 996工作制合法性争议中“同意”真实性的社会学质疑
- 武安小学考试试卷及答案
- 向人大申请监督申请书
- 2025年初级会计考试真题及参考答案
- 低头族现象分析与应对策略
- 研发部门激励活动方案
- 民法典合同编案例课件
- 甘蔗制糖毕业论文
- 2025至2030中国航空燃油行业发展趋势分析与未来投资战略咨询研究报告
- 初中英语人称代词专项练习题
- 2025年浙江省公安机关人民警察特殊职位公务员招录考试(网络安全技术)历年参考题库含答案详解(5套)
- 房屋安全性鉴定方案
- 智慧口岸数据可视化工具创新创业项目商业计划书
评论
0/150
提交评论