📄 memory.cpp
字号:
// Memory.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include "MyMemory.h"
int main(int argc, _TCHAR* argv[])
{
CMyMemory memory;
char cmd[256];
int pos;
int size;
while(1)
{
printf("#>");
cin>>cmd;
if(!strcmp(cmd,"showdetail"))
{
memory.ShowDetail();
}
else if(!strcmp(cmd,"allocation"))
{
cout<<"size:";
cin>>size;
memory.Allocation(size);
memory.ShowDetail();
}
else if(!strcmp(cmd,"release"))
{
cout<<"Block No:";
cin>>pos;
if(pos>=0 && pos<memory.EmptyList.ListSize())
{
memory.Release(pos);
memory.Merge();
}
}
/*else if(!strcmp(cmd,"merge"))
{
memory.Merge();
memory.ShowDetail();
}*/
else if(!strcmp(cmd,"exit"))
{
return 0;
}
else//(!strcmp(cmd,"help"))
{
system("cls");
cout<<"command error!"<<endl;
cout<<"[HELP]"<<endl;
cout<<"allocation\tallocation a block"<<endl;
cout<<"release\t\trelease a block"<<endl;
cout<<"merge\t\tmerge blank block"<<endl;
cout<<"exit\t\texit program"<<endl;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -