occupy_quantity=
wait_quantity=
}
//讀數據文件
int readData()
{
FILE *fp;
char fname[
int i;
cout<< strcpy(fname,"10trouble1.txt"); //cin>>fname; if((fp=fopen(fname,"r"))==NULL){ cout<<"錯誤,文件打不開,請檢查文件名:)"< return 0; } else{ while(!feof(fp)){ fscanf(fp,"%d %d",&occupy[occupy_quantity].resource,&occupy[occupy_quantity].process); occupy_quantity++; } } cout<<"請輸入進程等待表文件的文件名:"< strcpy(fname,"10trouble2.txt"); //cin>>fname; if((fp=fopen(fname,"r"))==NULL){ cout<<"錯誤,文件打不開,請檢查文件名:)"< return 0; [1] [2] [3] [4] [5]
From:http://tw.wingwit.com/Article/program/czxt/201311/24118.html