文件名称:复件 轮渡问题

  • 所属分类:
  • 其它资源
  • 资源属性:
  • [C/C++] [源码]
  • 上传时间:
  • 2008-10-13
  • 文件大小:
  • 2.55kb
  • 下载次数:
  • 0次
  • 提 供 者:
  • 西**
  • 相关连接:
  • 下载说明:
  • 别用迅雷下载,失败请重下,重下不扣分!

介绍说明--下载内容均来自于网络,请自行研究使用

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
(系统自动生成,下载前可以参看下载内容)

下载文件列表

压缩包 : 65520755复件 轮渡问题.rar 列表
复件 轮渡问题
复件 轮渡问题\汽车轮渡口算法设计.txt
复件 轮渡问题\test2.cpp

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度更多...
  • 请直接用浏览器下载本站内容,不要使用迅雷之类的下载软件,用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.

相关评论

暂无评论内容.

发表评论

*主  题:
*内  容:
*验 证 码:

源码中国 www.ymcn.org