复件 轮渡问题

所属分类:Windows编程
开发工具:Visual C++
文件大小:2KB
下载次数:22
上传日期:2005-12-09 23:02:32
上 传 者xifengfeng9
说明:  1. 汽车轮渡口,过江渡船每次能载10辆车过江,过江车辆分为客车类和货车类,上渡船有如下规定:同类车先到先上船,客车先于货车上渡船,且每上4辆客车,才允许上一辆货车。若等待客车不足4辆,则从货车代替,若无货车等待允许客车上船。试写一个算法模拟渡口管理。 算法设计: 1客车和货车均建立一个链式队列,初始均为空。以后来一辆车不是货车就是客车,因此可以说整个程序的事件驱动event就是这两个,客车表示1,货车表示0. 2轮船还没有到达时客车和货车均按次序排在各自队列中。 3轮船到达时,根据两个队列的情况,分别处理。处理如下: a 客车数不满4辆,则将排在前面的货车上船,但总数不能超过10,若没有货车等待,客车直接上船。 b 客车数满4,但不满8辆,客车先上,排在前面的只有一辆货车可以上船,若没有货车等待则货车不上。 c 客车满8辆但不满10,客车上船,排在前面的货车最多可以上2辆,但总数不能超过10。 d 客车满10,则全上客车,但总数不能超过10。
(1. I car ferry, crossing the river each ferry can carry 10 cars crossing the river, crossing the river into passenger vehicles and goods category, Ferry on the following provisions : first vehicle in a first embarkation, the first passenger ferry in the truck and four on each passenger will be permitted on a lorry. If waiting for the bus less than four, then replace the truck, without waiting for the lorry to allow passenger embarkation. Try to write a simulated crossing management. Algorithm design : a bus and the truck were established a chain cohort, the initial were empty. Later, a car is not a passenger vehicle is, it can be said of the entire process event-driven event is the two, said a passenger, said the lorry 0. Two ships have not yet arrived at the bus and the truck were ranked )

文件列表:
复件 轮渡问题 (0, 2005-12-09)
复件 轮渡问题\汽车轮渡口算法设计.txt (947, 2005-03-22)
复件 轮渡问题\test2.cpp (4386, 2002-01-01)

近期下载者

相关文件


收藏者