文件名称:b
介绍说明--下载内容均来自于网络,请自行研究使用
【问题描述】:
有一个渡口,每条渡轮一次能装载10辆汽车过江,过江车辆分为客车和货车两类,上渡轮有如下规定:
⑴同类汽车先到先上船;
⑵客车先于货车上船;
⑶每上4辆客车才允许上一辆货车,但若等待的客车不足4辆则用货车填补,反过来,若没有货车等待则用客车填补;
⑷装满10辆后则自动开船,当等待时间较长时车辆不足10辆也应人为控制发船。
【实现提示】:
此题可建立和使用两个链式队列,一个为客车队列,另一个为货车队列,到渡口需过江的汽车分别进入到相应队列中。当渡口有渡轮时先让客车队列中的4部客车出队并开进渡轮,再让货车队列中的4部货车出队并开进渡轮,若某一类车辆队列为空则从另一队列中补充。当渡轮上装满10辆后则自动开船,此时应输出已装每辆车的车号。若装载不足10辆,但两个车辆队列全为空,应继续等待一段时间,若等待时间较长,仍不满载则应人为控制开船。
-Descr iption of the problem:
There is a ferry, and each ferry will carry a 10 car crossing the river, the river traffic is divided into two types of passenger cars and trucks, on the ferry the following provisions:
⑴ similar first-come, first car on board
⑵ bus before the goods on board
⑶ 4 per passenger on board a goods vehicle will be allowed, but waiting for the bus less than 4 are filled with goods, in turn, if there is no vehicle waiting for the bus to fill with
⑷ filled automatically after 10 set sail, when the waiting time less than 10 when the vehicle should also be made artificially control the ship.
【Achieve prompt:
This title can be established and the use of two chain queue, a queue for the bus, and another queue for the goods, to take the ferry crossing the river into the car, respectively, the corresponding queue. When there are ferry crossing bus queue when the first four of the team bus and into the ferry, the queue of trucks allowed four trucks and
有一个渡口,每条渡轮一次能装载10辆汽车过江,过江车辆分为客车和货车两类,上渡轮有如下规定:
⑴同类汽车先到先上船;
⑵客车先于货车上船;
⑶每上4辆客车才允许上一辆货车,但若等待的客车不足4辆则用货车填补,反过来,若没有货车等待则用客车填补;
⑷装满10辆后则自动开船,当等待时间较长时车辆不足10辆也应人为控制发船。
【实现提示】:
此题可建立和使用两个链式队列,一个为客车队列,另一个为货车队列,到渡口需过江的汽车分别进入到相应队列中。当渡口有渡轮时先让客车队列中的4部客车出队并开进渡轮,再让货车队列中的4部货车出队并开进渡轮,若某一类车辆队列为空则从另一队列中补充。当渡轮上装满10辆后则自动开船,此时应输出已装每辆车的车号。若装载不足10辆,但两个车辆队列全为空,应继续等待一段时间,若等待时间较长,仍不满载则应人为控制开船。
-Descr iption of the problem:
There is a ferry, and each ferry will carry a 10 car crossing the river, the river traffic is divided into two types of passenger cars and trucks, on the ferry the following provisions:
⑴ similar first-come, first car on board
⑵ bus before the goods on board
⑶ 4 per passenger on board a goods vehicle will be allowed, but waiting for the bus less than 4 are filled with goods, in turn, if there is no vehicle waiting for the bus to fill with
⑷ filled automatically after 10 set sail, when the waiting time less than 10 when the vehicle should also be made artificially control the ship.
【Achieve prompt:
This title can be established and the use of two chain queue, a queue for the bus, and another queue for the goods, to take the ferry crossing the river into the car, respectively, the corresponding queue. When there are ferry crossing bus queue when the first four of the team bus and into the ferry, the queue of trucks allowed four trucks and
(系统自动生成,下载前可以参看下载内容)
下载文件列表
轮船渡口管理
............\classCar.h
............\classShip.h
............\function.h
............\LinQueue.h
............\main.cpp
............\ReadMe.txt
............\classCar.h
............\classShip.h
............\function.h
............\LinQueue.h
............\main.cpp
............\ReadMe.txt