new
所属分类:其他
开发工具:C/C++
文件大小:2KB
下载次数:6
上传日期:2018-06-18 12:18:29
上 传 者:溪石
说明: 患者在医院看病过程:先排队等候,再看病治疗。
在排队的过程中主要重复做两件事情,一是患者达到诊室,将病历交给护士,排到等候队列中候诊;二是护士从等候队列中取出下一个患者的病历,该患者进入诊室看病。下班后,不再接受病人排队。按照“先到先服务”原则,设计一个算法模拟病人等候就诊的过程。
输入说明:“病人到达”通过控制台输入‘a’模拟,“护士让下一位患者就诊”通过控制台输入‘n’模拟,“不再接受病人排队” 通过控制台输入‘q’模拟。
输出说明:当有“病人到达”命令时,提示“病例号:”,输入一个整型数字后,输出“您的病例号是X,还有Y人在等候”;当有“护士让下一位患者就诊”命令时,“病例号为X的病人就诊”;当有“不再接收病人排队”命令时,则队列中所有元素出队,输出“今天看诊结束,下列病人依次就诊:X,Y,Z”,程序终止。
(Patients in the hospital: first wait in line, then see a doctor.
In the process of queuing, the main repetition of two things, one is that the patient reaches the consulting room, the medical record is handed to the nurse, and the waiting queue is waiting in the waiting queue; the two is the nurse taking the next patient's medical record from the waiting queue, and the patient enters the consulting room to see the doctor. After work, the patient is no longer in line. According to the principle of "first come, first served", an algorithm is designed to simulate the waiting process of patients.
Input Description: "patient arrival" input 'a' simulation through the console, "nurse let the next patient visit" through the console input 'n' simulation, "no longer accept patient queues" through the console input 'Q' simulation.)
文件列表:[举报垃圾]
new.c, 6052 , 2018-05-11
近期下载者:
相关文件:
收藏者: