www.pudn.com > 页面置换问题.rar > PageReplace.cpp


#include "iostream.h" 
#include "stdlib.h" 
#include "stdio.h" 
 
#define MS 10000 
#define MP 100 
 
int MaxSize=40, MaxPage=3, RandomSize=1000; 
 
int clocks[MS];//={7,0,1,2,0,3,0,4,2,3,0,3,2,1,2,0,1,7,0,1}; 
int record[MP], pages[MP]; 
int detail[MS][MP]; 
 
void input() 
{ 
	int i; 
	system("cls"); 
	cout<<"输入页面号长度在 1-40 之间、随机数范围在 1-10 之间将有置换图输出。"<>MaxSize; 
	cout<<"输入页面号随机数范围:"; cin>>RandomSize; 
	cout<<"输入物理块数:"; cin>>MaxPage; 
	cout<=MaxPage) notfull=false; 
			copypage(detail[i],pages); 
		} 
		else 
		{ 
			k=0; 
			for (x=1; xrecord[k]) k=x; 
			pages[k]=clocks[i]; 
			x=i+1; 
			while(x=MaxPage) notfull=false; 
			copypage(detail[i],pages); 
		} 
		else 
		{ 
			for (x=0; x>ch; 
	} 
	while (ch!='Y' && ch!='y' && ch!='N' && ch!='n'); 
} 
 
}