91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

/* 假設只有一個醫生,在一段時間內隨機地來幾位病人;假設病人到達的時間間隔為0-14分鐘 之間的某個隨機值,每個病人所需處更有時間為1-9分鐘之間的某個隨機值。試用隊列結構進行模擬。 */ #include #include #include #include typedef struct { int arrive; int treat; }PATIENT; typedef struct queue { PATIENT data; struct queue *link; }QUEUE; ………… ……

資源截圖

代碼片段和文件信息

/*
假設只有一個醫生,在一段時間內隨機地來幾位病人;假設病人到達的時間間隔為0-14分鐘
之間的某個隨機值,每個病人所需處更有時間為1-9分鐘之間的某個隨機值。試用隊列結構進行模擬。
*/


#include
#include
#include
#include


typedef?struct
{
int?arrive;
int?treat;
}PATIENT;

typedef?struct?queue
{
PATIENT?data;
struct?queue?*link;
}QUEUE;


void?EnQueue(QUEUE?**headQUEUE?**tailPATIENT?x)
//進隊操作
{
QUEUE?*p;
p=(QUEUE*)malloc(sizeof(QUEUE));
p->data=x;
p->link=NULL;
if(*head==NULL)
*head=*tail=p;
else
{
(*tail)->link=p;
*tail=p;
}
}


int?DeQueue(QUEUE?**headQUEUE?**tailPATIENT?*cp)
//出隊操作
{
QUEUE?*p;
p=*head;
if(*head==NULL)
return?1;
*cp=(*head)->data;
*head=(*head)->link;
if(*head==NULL)
*tail=NULL;
free(p);
return?0;
}

void?OutputQueue(QUEUE?*head)
{
while(head!=NULL)
{
printf(“到達時間:[%d]處理時間:[%d]\n“head->data.arrivehead->data.treat);
head=head->link;
}
}


void?InitData(PATIENT?*paint?n)
{
int?parr=0;
int?i;
for(i=0;i {

評論

共有 條評論