資源簡介
課題內容和要求
火車票模擬訂票系統是功能包括:管理員管理系統和乘客訂票系統兩大子系統。
一、管理員系統中,管理員通過身份驗證,可以對火車時刻表進行插入、刪除、修改、查詢、顯示等操作。
二、乘客訂票系統中,乘客通過顯示的火車時刻表,可以查找車票、訂購車票、退訂車票。
三、退出系統時保存火車時刻表和乘客信息表。
PS:火車時刻表包含的數據:火車的車次、始發地、目的地、時間表、價格、余票數、編號。
乘客信息包含的數據:乘客的姓名、身份證、訂票數量、要訂火車的編號。
代碼片段和文件信息
#ifdef?WIN32
#pragma?warning?(disable:?4514?4786)
#endif
#ifndef?_TImetaBLE
#define?_TImetaBLE
#ifndef?_INTERFACE
#define?_INTERFACE
#include
#include
#include
#include
#include?
using?namespace?std;
class?Timetable
{
protected:
string?checi;/*車次*/
string?shifadi;/*始發地*/
string?mudidi;/*目的地*/
string?shijianbiao;?/*時間表*/
string?price;/*價格*/
int?yupiaoshu;/*余票數*/
string?bianhao;
public:
Timetable(string?ccstring?sfdstring?mddstring?sjbstring?pint?ypsstring?bianhao);/*構造函數*/
string?GetCheci();/*返回車次*/
string?GetShifadi();/*返回始發地*/
string?GetMudidi();/*返回目的地*/
string?GetShijianbiao();/*返回時間表*/
string?GetPrice();/*返回價格*/
int?GetYupiaoshu();/*返回余票數*/
string?GetBianhao();/*返回編號*/
bool?operator<(Timetable?tb)const;/*重載<運算,set容器要求元素之間滿足該關系*/
};
#endif
Timetable::Timetable(string?ccstring?sfdstring?mddstring?sjbstring?pint?ypsstring?bianha)//構造函數實現
{
checi=cc;
shifadi=sfd;
mudidi=mdd;
shijianbiao=sjb;
price=p;
yupiaoshu=yps;
bianhao=bianha;
}
string?Timetable::GetCheci()
{
return?checi;
}
string?Timetable::GetShifadi()
{
return?shifadi;
}
string?Timetable::GetMudidi()
{
return?mudidi;
}
string?Timetable::GetShijianbiao()
{
return?shijianbiao;
}
string?Timetable::GetPrice()
{
return?price;
}
int?Timetable::GetYupiaoshu()
{
return?yupiaoshu;
}
string?Timetable::GetBianhao()
{
return?bianhao;
}
bool?Timetable::operator<(Timetable?tb)const/*重載<運算,set容器要求元素之間滿足該關系*/
{
if(checi return?true;
else?
return?false;
}
class?Interface//管理員界面類
{
protected:
set
- 上一篇:TensorFlow 內核剖析
- 下一篇:擴展歐幾里德算法c++代碼
評論
共有 條評論