%",f); cout<<"%"<<endl; } void outopt(Page page[10],SeqStack *Memory,int x,float e) ///page 为页表, Memory 为内存栈, c 为物理地址, e 为命中次数, { float f; // 定义 f 为缺页率 cout<<" 页号"<<" "<<" 块号"<<" "<<" 状态位"<<endl; for(int i=0;i<Length;i++) { cout<<" "<<page[i].Yh<<" "<<page[i].kh<<" "<<page[i].State<<endl; } printf(" 内存分配块: \n"); cout<<" 序号"<<" "<<" 页号"<<endl; for(int k=0;k<Memory->top+1;k++) cout<<" "<<k<<" "<<Memory->data[k]<<endl; for(int j=Memory->top+1;j<kuaisu;j++) cout<<" "<<j<<" "<<"-1"<<endl; printf(" 访问次数: %d \n",x); int h=x-e; printf(" 缺页次数: %d \n ",h); f=(1-e/x)*100; printf(" 缺页率:%5.2f%",f); cout<<"%"<<endl; } int jisu1(){ int c1; for(int i=kuaisu;i<v;i++) { int flag0=0; if(Visit[i]==neichun->data[0]) { flag0=1; c1=i; } if(flag0==1) break; if(Visit[i]!=neichun->data[0]) c1=Maxsize+; } return c1;