全球旧事资料 分类
、链队列类型templatetype
ameQTclassMyQueuepublicMyQueue初始化队列fro
trear
ewLQNodeQTMyQueuevoidE
QueueQT入队列,生成一个新结点
ode,为结点赋值,rear
ext
ode
ode
extNULLvoidD
QueueQT出对列,对头元素出队,若对列不空fro
tfro
t
extboolEmpty
f判断一个队列是否为空,若fro
t
extNULL则队列为空privateLQNodeQTfro
t指向队列头的指针LQNodeQTrear指向队列尾的指针
4、其他类型设计classAirLi
eclassAirLi
e将航线抽象为一种抽象数据类型类frie
dvoidI
itAirLi
eAirLi
eli
efrie
dostreamoperatorostreamoutputco
stAirLi
eli
epublicAirLi
evoid初始化类成员AirLi
evoidstri
gGetE
dPoi
t取得终点站站名i
tGetSeatNumi
t取得票数i
tGetSeatRemai
i
t取得剩余票数voidSetSeatRemai
i
t
umi
twhickWeek修改剩余票数stri
gGetFlightNumvoid取得航班号voidI
sertPasse
gerPasse
gertemp有乘客订票时,保存该乘客的信息,pListI
sertNodeboolIsFlyi
twhichWeekco
st查询该天有没有航班voidI
sertAwaitPasse
gertemp有登记候补的乘客时,保存该乘客的信息,pQueueE
QueueboolDeletePasse
gerPasse
ger从链表中删除乘客信息,pListDeleteNodei
tIfAwaitBooki
ttiNumi
twhichWeek遍历队列,查看是否有符合条件的候补乘客Passe
ger
odewhilepQueueEmptyif有符合的返回1返回0
fprivatestri
ge
dPoi
tstri
gflightNumstri
gairNumboolweek8i
tseatNum8i
tseatRemai
8MyListPasse
gerpListMyQueuePasse
gerpQueueclassPasse
gere
umTicketGradeAABBCCclassPasse
gerpublicPasse
gervoidPasse
gerco
ststri
gpasse
gerName
好听全球资料 返回顶部