熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> 操作系統 >> 正文

十大題型算法全實現——(八)作業調度[8]

2022-06-13   來源: 操作系統 

  for(j=;j

  if(jobs[j].visited==0){

  jobs[j].wait_time=(current_hour-jobs[j].reach_hour)*60+(current_minute-jobs[j].reach_minite);

  jobs[j].excellent=(float)(jobs[j].wait_time/jobs[j].need_time);

  }

  }

  for(j=0;j

  if((jobs[j].visited==0)&&(jobs[j].excellent>current_excellent)){

  p=j;

  current_excellent=jobs[j].excellent;

  }

  }

  jobs[p].start_time=current_hour*100+current_minute;

  jobs[p].wait_time=(current_hour-jobs[p].reach_hour)*60+(current_minute-jobs[p].reach_minite)+jobs[p

  ].need_time;

  cout<

  time<

  current_hour=current_hour+(jobs[p].need_time+current_minute)/60;

  current_minute=(jobs[p].need_time+current_minute)%60;

  jobs[p].visited=1;

  total_time+=jobs[p].wait_time;

  }

  cout<

  }

  //顯示版權信息函數

  void version()

  {

  cout<

  cout<<" ┏━━━━━━━━━━━━━━━━━━━━━━━┓"<

  cout<<" ┃     作業調度模擬系統        ┃"<

  cout<<" ┠───────────────────────┨"<

  cout<<" ┃   (c)All Right Reserved Neo       ┃"<

  cout<<" ┃      sony006@163.com          ┃"<

  cout<<" ┃     version 2004 build 1122      ┃"<

  cout<<" ┗━━━━━━━━━━━━━━━━━━━━━━━┛"<

  cout<

  }

[1]  [2]  [3]  [4]  [5]  [6]  [7]  [8]  [9]  


From:http://tw.wingwit.com/Article/program/czxt/201311/24016.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.