⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.cpp

📁 操作系统
💻 CPP
字号:
#include <fstream.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

struct operation
{
	int time;		//起始时间
	int block;		//内存页数
	int oper;		//操作
	int protection;	//权限
};

int main()
{
	FILE * file;
	file = fopen("opfile", "wb");	//"opfile"为二进制用确定内存操作
	operation op;

	for(int j = 0; j < 6; j++)
	{
		for(int i = 0; i <5; i++)
		{
			//0-PAGE_READONLY;
			//1-PAGE_READWRITE;
			//2-PAGE_EXECUTE;
			//3-PAGE_ECECUTE_READ;
			//4-PAGE_EXECUTE_READWRITE;
			op.time = rand() % 1000;		//随即生成等待时间
			op.block = rand() % 5 + 1;		//随即生成块大小
			op.oper = j;
			op.protection = i;
			fwrite(&op, sizeof( operation), 1, file);	//将生成的结构写入文件
		}
	}
	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -