int quantity;
int start; //定義開始時磁頭所在位置
//初始化函數
void initial()
{
int i;
for(i= queue[i].go=-1; queue[i].visited=0; } start=53;//磁頭的初始位置 } //讀入磁道號流 void readData() { FILE *fp; char fname[20]; int temp,i; cout<<"請輸入磁道號流文件名:"; strcpy(fname,"7hard.txt"); cin>>fname; if((fp=fopen(fname,"r"))==NULL){ cout<<"錯誤,文件打不開,請檢查文件名:)"< } else{ while(!feof(fp)){ fscanf(fp,"%d ",&temp); queue[quantity].go=temp; quantity++; } cout< [1] [2] [3] [4] [5] [6]
From:http://tw.wingwit.com/Article/program/czxt/201311/24027.html