南京邮电大学实验报告版 2
实 验 报 告
(20 / 2015 学年 第 学期)
课程名称实验名称实验时间年月日指导单位指导教师
学生姓名班级学号学院(系)专 业
实 验 报 告
实验名称指导教师实验类型实验学时实验时间实验目的和要求
通过请求页式存储管理中页面置换算法模拟设计,了解虚拟存储技术的技术特点,掌握请求页式存储管理的页面置换算法设计实现下面算法,并二、实验环境(实验设备)
Vc++6.0实验原理及内容
实验四
Login用户登录
bool chklogin(char *users, char *pwd)
{
int i;
for(i=0; i<8; i++)
{
if( (strcmp(users,usrarray[i].name)==0) && (strcmp(pwd,usrarray[i].pwd)==0))
return true;
}
return false;
}
Create创建文件
int create()
{
temp=initfile(" ",0);
cin>>temp->filename;
cin>>temp->content;
if(recent->child==NULL)
{
temp->parent=recent;
temp->child=NULL;
recent->child=temp;
temp->prev=temp->next=NULL;
cout<
}
else
{
ttemp=recent->child;
while(ttemp->next)
{
ttemp=ttemp->next;
if(strcmp(ttemp->filename,temp->filename)==0&&ttemp->isdir==0)
{
printf("对不起,文件已存在!");
return 1;
}
}
ttemp->next=temp;
temp->parent=NULL;
temp->child=NULL;
temp->prev=ttemp;
temp->next=NULL;
cout<
}
return 1;
}
int dir()
{
int i=0,j=0;
temp=new fnode;
temp=recent;
if(temp!=root)
{cout< "<
if(temp->child==NULL)
{
cout<
return 1;
}
temp=temp->child;
while(temp)
{
if(temp->isdir)
{cout<\ "<filename<
else
{cout< "<filename<
temp=temp->next;
}
cout<
}
Read读取文件
int read()
{
char filename[FILENAME_LENGTH];
cin>>filename;
if(recent->child==NULL)
{
cout<
return 1;
}
if(strcmp(recent->child->filename,filename)==0)
{
cout<child->content<
return 1;
}
else
{
temp=recent->child;
while(temp->next)
{
if(strcmp(temp->next->filename,filename)==0)
{cout<next->content<
return 1;}
}
cout<
}
}
int write()
{
char filename[FILENAME_LENGTH];
cin>>filename;
if(recent->child==NULL)
{
cout<
return 1;
}
if(strcmp(recent->child->filename,filename)==0)
{
recent->child->isopen=1;//设置文件标记为打开
cin>>recent->child->content;