页面置换模板.docxVIP

  • 2
  • 0
  • 约4.18千字
  • 约 19页
  • 2017-02-09 发布于湖北
  • 举报
页面置换模板

实验五实验过程:声明结构体,包含节点值name和下一个节点的位置指针next,创建作业序列,create();创建物理块的序列,开始用0来填充,pcreate()就是FIFO和LRU算法;实验代码:#includestdlib.h#includestdio.h#includemalloc.h#includeiostreamusing namespace std;typedef int datatype;typedef struct node{ int name; struct node *next;}dnode; typedef dnode*linkstack;int count=0;int n=0;int m=0;dnode *create(){ dnode*head,*p,*r; int x; head=r=NULL; printf(输入作业序列名,-1表示结束:); scanf(%d,x); while(x!=-1) { p=(dnode*)malloc(sizeof(dnode)); p-name=x; if(head==NULL) { head=p; r=p; n++; } else{ p-next=r-next; r-next=p; r=p; n++; } scanf(%d,x); } if(r) r-next=NULL; return head;}dnode*pcr

文档评论(0)

1亿VIP精品文档

相关文档