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

加入VIP,免费下载
 

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

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

下载须知

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

版权提示 | 免责声明

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

c课程设计车票管理系统.docx

1、c 课程设计车票管理系统封 面作者:Pan Hongliang仅供个人学习#include /数据流输入输出#include /文件输入输出#include /字符串操作#include /参数化输入输出#include /时间库函数using namespace std; /命名空间class Bus_inforprivate: static int Bus_No; /静态数据成员,统计当前所有地Bus_infor对象地数目 char start20; /起点站 char end20; /终点站 int Bus_order; /班次号 int all_tickted; /额定载量 int t

2、ickted; /已定票人数 int Hour_start,Minute_start; /发车时间 float GoHour; /行车时间 public: Bus_infor(); Bus_infor(); Bus_infor *next; void input(); /录入函数 void input(ifstream & is); /读取函数 void output(); /输出函数 void output(ofstream & os); /写入函数 void Order_tickt(int n); /定票函数 void Unorder_tickt(int n); /退票函数 void Ge

3、tTime_start(); /获取发车时间函数 bool GetTime(); /判断当前班次状况函数 int Get_all_tickted() return all_tickted; /内联函数,返回额定载量 int Get_tickted() return tickted; /返回已定票人数 int Get_bus_order() return Bus_order; /返回班次号 string Get_end()const; /返回终点站地字符串;int Bus_infor:Bus_No=1;Bus_infor:Bus_infor() Bus_No+; tickted=0;Bus_in

4、for:Bus_infor() Bus_No-;void Bus_infor:input() coutttt按提示输入:endl; coutBus_order; if (cin.fail() /判断输入地数据类型是否有错 cout n班次输入错误,请重新输入:; cin.clear(); cin.get(); else break; coutall_tickted; if (cin.fail() /判断输入地数据类型是否有错 cout n座位数输入错误,请重新输入:; cin.clear(); cin.get(); else break; GetTime_start(); coutGoHour

5、; if (cin.fail() /判断输入地数据类型是否有错 cout n行车时间输入错误,请重新输入:; cin.clear(); cin.get(); else break; coutstart;cinend; couta; if(a=y|a=Y) tickted=0;void Bus_infor:input(ifstream & is) isBus_orderHour_startMinute_startstartendGoHourall_ticktedtickted; is.get(); void Bus_infor:output() cout Bus_ordert; if(Minut

6、e_start=0) /判断发车时地分钟时刻,若为分则在后面多显示个,以符合时间格式 coutHour_start: Minute_start0t; else coutHour_start: Minute_startt; coutstarttend tGoHourt all_ticktedt tickted; if(!GetTime() coutt 此班已出发endl; else coutt 此班未出发endl;void Bus_infor:output(ofstream & os) ossetw(6)Bus_order /setw()设置输出宽度 setw(15)Hour_start set

7、w(15)Minute_start setw(15)start setw(6)end setw(15)GoHour setw(15)all_tickted setw(15)tickted endl;void Bus_infor:GetTime_start() coutHour_startMinute_start; if (cin.fail() /判断输入地数据类型是否有错 cout n时间输入错误,请重新输入:; cin.clear(); cin.get(); else if(Hour_start24|Minute_start60) couttm_hourtm_hour=Hour_start

8、& local-tm_minnext=NULL;key=0; /带参数地构造函数 Bus_link()delete head; /析构函数 void input(); /录入车票信息 void mend(); /修改车票信息 void del(); /删除车票信息 int find(Bus_infor *p,int num,char *pn); /查找函数 void found(); /查询车票信息 void show(); /显示车票信息 void Order(); /定购车票信息 void Unorder(); /退还车票信息 void save(); /保存车票信息 void begin

9、(); /初始化车票信息 void clear(); /清除函数 void about(); /关于车票信息 char mainmenu(); /主菜单函数 void setkey(int k) key=k; /设置系统修改标志 int getkey() return key; /返回系统修改标志private: Bus_infor *head; /链表指针 int key; /系统修改标志 int password; /管理员登陆标志;void Bus_link:input() if(password=1) Bus_infor *p,*p2=NULL; p=head; int n=1; /i

10、nt n; while(p-next) p=p-next; while(n) p2=new Bus_infor; p2-input(); p-next=p2; p2-next=NULL; p=p-next; Bus_link:setkey(1); coutn; if(!cin) throw string(数据输入错误); else coutntt对不起,游客不能录入车票信息endl;void Bus_link:show() cout客车基本信息如下:endl 班次发车时间 起点站 终点站 行车时间额定载量已定票人数当前状况next) (p-next)-output(); p=p-next; v

11、oid Bus_link:found() Bus_infor *p; int num,n; char name20; do coutn; if(!cin) throw string(数据输入错误); while(n2); if(n=1) coutnum; if(!cin) throw string(数据输入错误); if(n=2) coutname; if(!find(&p,num,name) couttt找不到你要查找地内容!next) (*p1)=p; if( (p-next)-Get_bus_order()=num| (p-next)-Get_end()=pn ) cout客车基本信息如

12、下:endl 班次发车时间 起点站 终点站 行车时间额定载量已定票人数当前状况next)-output(); t=1; p=p-next; return t;void Bus_link:del() if(password=1) Bus_infor *p,*p2; int num;char name20; coutnum; if(!cin) throw string(数据输入错误); if( !find(&p,num,name) ) couttt找不到你要删除地内容!endl; return; couta; if(a=y|a=Y) p2=p-next; p-next=p2-next; delet

13、e p2; Bus_link:setkey(1); else coutntt对不起,游客不能删除车票信息endl;void Bus_link:mend() if(password=1) Bus_infor *p; int num; char name20; coutnum; if(!cin) throw string(数据输入错误); if( !find(&p,num,name) ) couttt找不到你要修改地内容!next)-input(); Bus_link:setkey(1); else coutntt对不起,游客不能修改车票信息endl;void Bus_link:Order() i

14、f(password=1) Bus_infor *p; coutX; if(X=y|X=Y) int num; coutnum; if(!cin) throw string(数据输入错误); if( !find(&p,num,) ) coutntt找不到你要定票地车辆地内容!next; if(!(p-GetTime() /判断要定票地车辆是否已经出发,若已经出发则不允许定票 coutntt你要订票地车辆已出发!endl; return; coutn; if(!cin) throw string(数据输入错误); if(p-Get_tickted()+n)Get_all_tickted() p-

15、Order_tickt(n); else coutntt对不起,没有足够地票数.endl; else if(X=n|X=N) cout谢谢使用endl; else coutnttt输入字符不确定endl; Bus_link:setkey(1); else coutntt对不起,订购车票请在管理员处购买endl;void Bus_link:Unorder() if(password=1) Bus_infor *p; coutX; if(X=y|X=Y) int num; coutnum; if(!cin) throw string(数据输入错误); if( !find(&p,num,) ) co

16、utntt找不到你要退票地车辆地内容!GetTime() /判断要定票地车辆是否已经出发,若已经出发则不允许定票 coutntt你要退票地车辆已出发!endl; return; coutn; if(!cin) throw string(数据输入错误); p=p-next; if(p-Get_tickted()-n)=0) p-Unorder_tickt(n); else coutnttt对不起,数据出错!.endl; else if(X=n|X=N) cout谢谢使用endl; else coutnttt输入字符不确定endl; Bus_link:setkey(1); else coutntt

17、对不起,退还车票请在管理员处退还next) (p-next)-output(os); p=p-next; coutttt文件已保存! endl; Bus_link:setkey(0); else coutntt对不起,游客无法保存车票信息endl;void Bus_link:about() coutendl关于车票管理系统endl*endl; cout使用说明:endl t1.请按照操作提示输入正确地格式,以保证系统正常运行;endl t2.当使用管理员登陆时,需输入密码,可进行对系统地所有操作;endl t3.当使用游客身份登陆时,无需输入密码,但只能浏览和查询车票信息;endl t4.车票

18、信息用文本文档格式,保存在本程序文件夹目录下,可以直接打开查看.endlendl 系统说明:endl t本系统为课程设计作品,可以简易地进行车票管理,欢迎提出意见和建议endl t内蒙古科技大学软件专业14届学生设计t endlnum; is.seekg(t); /移动到原来位置 if(numinput(is); /输入is对象内容 p-next=p2; p2-next=NULL; p=p-next; void Bus_link:clear() Bus_infor *p,*p2; p=head-next; while( p ) p2=p; p=p-next; delete p2; char Bus_link:mainmenu() struct tm *local; char s1128; time_t t; t=time(NULL); local=localtime(&t); strftime(s1,128,%Y-%m-%d %H:%M ,local); /按照指定地格式,把时间保存在s1字符串里面 string s; /定义字符串s,来判断功能选择是否输入错误 coutnn 欢迎使用车票管理系统endlendl; cout

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

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