for(i= p=0; while(queue[p].visited!=0){ p++; } for(j=p;j if((queue[j].visited==0)&&(abs(current-queue[p].go)>abs(current-queue[j].go))){ p=j; } } cout< } //電梯算法 void elevator() { int i,j,p,flag; int total=0; int current; cout< cout<<"電梯調度算法"< //磁頭初始向裡 cout<<"磁頭初始向裡的訪問磁道號順序流:"; current=start; for(i=0;i flag=1000; p=-1; for(j=0;j if((queue[j].visited==0)&&(queue[j].go>=current)){ if(abs(queue[j].go-current) [1] [2] [3] [4] [5] [6]
From:http://tw.wingwit.com/Article/program/czxt/201311/24023.html