1 / 4
文档名称:

时间片轮转算法C版.docx

格式:docx   大小:69KB   页数:4页
下载后只包含 1 个 DOCX 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

时间片轮转算法C版.docx

上传人:Joshua_lee 2021/12/1 文件大小:69 KB

下载得到文件列表

时间片轮转算法C版.docx

相关文档

文档介绍

文档介绍:Pleasure Group Office【T985AB-B866SYT-B182C-BS682T-STT18】
时间片轮转算法C版
 int Queue_c::qEnQueue(ElemType e)
 {
 if(qFull())return ERROR;
 Q[rear]=e;
 rear=(rear+1)%QueueNum;
 return OK;
 }
 //=================qDeQueue===============================
 ElemType Queue_c::qDeQueue()
 {
 ElemType e;
 if(qEmpty())return ERROR;
 e=Q[front];
 Q[front]=QueuePre;
 front=(front+1)%QueueNum;
 return e;
 }
//===================qGetNumber=============================
 int Queue_c::qGetNumber()
 {int i;
 i=((rear-front+QueueNum)%QueueNum);
 return i;
 }
//==================qGetElem==============================
 ElemType Queue_c::qGetElem(int i)
 {
 if(qEmpty()){cout<<"ERROR!"<<endl;return ERROR;}
 if(i>qGetNumber()-1)
 {
 cout<<"ERROR! there is no "<<i<<",or no "<<i<<" in Queue now"<<endl;
 return ERROR;
 }
 return Q[(front+i)%QueueNum];
 }
//======================qShowQueue==========================
 int Queue_c::qShowQueue()
 {int i;
 if(qEmpty())return ERROR;
 for(i=front;i!=rear%QueueNum;i=(i+1)%QueueNum)
 {
 cout<<Q[i]<<" ";
 }//endfor
 cout<<endl;
 return OK;
 }
//======================qShowAll=========================
/*int Queue_c::qShowAll()
{
int i;
for(i=0;i<QueueNum;i++)cout<<Q[i]<<" ";
cout<<endl;
return OK;
}*/
/* int Queue_c::qXChange(int i)
 {
 ElemType t;
 if(1==qGetNumber())return OK;
 if(qEmpty()){cout