?? dopage.cpp
字號:
#include <iostream>
#include <fstream>
#include "fifo.h"
#include "lru.h"
#include "scr.h"
using std::ifstream;
using std::cout;
int main(int argc,char *argv[])
{
if (argc != 4)
{
cout << "Error input!";
exit(1);
}
ifstream file( argv[3] );
if (!file.is_open())
{
cout << "Not fount page file!";
exit(2);
}
int page_max = atoi(argv[1]);
if (page_max < 3)
page_max = 3;
cout << "There are " << page_max << " pages AND ";
Mem_page *mp;
if(!strcmp(argv[2], "fifo"))
{
cout <<"Using FIFO Algorithm" << endl;
mp = new Fifo_page(page_max);
}
else if(!strcmp(argv[2], "lru"))
{
cout <<"Using LRU Algorithm" << endl;
mp = new Lru_page(page_max);
}
else
{
cout <<"Using SCR Algorithm" << endl;
mp = new Scr_page(page_max);
}
char page_id[10];
while (!file.eof())
{
file.getline(page_id, sizeof(page_id));
mp->do_page( atoi(page_id) );
mp->show_page();
}
file.close();
//mp->show_page();
delete mp;
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -