动态分区存储管理方式的算法模拟
c语言写的程序 #include<stdio.h> #include<string.h> #include<stdlib.h> /*库函数*/ #define MAXSIZE 1000 /*最大内存容量*/ #define MINSIZE 1 /*允许最小的碎片*/ #define LEN sizeof(struct Mem_list) void display(); void menu_choice(); void mem_allocation(); int check_num(int n); void error_message(int n); void temp(); void mem_combine(); void move_disk(); void mem_recycle(); void dis_MAT(); /*函数说明*/ typedef struct Mem_list { int num; int status; float size; float addr; struct Mem_list *next; }ML,*MLP; MLP u_lst,f_lst; void main() /*主函数*/ { f_lst=(ML *)malloc(LEN); u_lst=(ML *)malloc(LEN); /*初始化*/ u_lst->next=NULL; u_lst->num=0; u_lst->size=0; u_lst->addr=0; u_lst->status=1; f_lst->num=0; f_lst->size=MAXSIZE; f_lst->addr=0; f_lst->status=0; f_lst->next=NULL; display(); menu_choice(); return; } void display() /*菜单显示函数*/ { printf("\n===============MemoryFunction-Munu================\n"); printf("1. Memory Allocation "); printf("2. Memory Recycle\n"); printf("3. Display MAB"); printf("4. Memory Combine\n"); printf("5. Clear_Screen&Display_menu "); printf("6. Quit\n"); return; }
#include<string.h>
#include<stdlib.h> /*库函数*/
#define MAXSIZE 1000 /*最大内存容量*/
#define MINSIZE 1 /*允许最小的碎片*/
#define LEN sizeof(struct Mem_list)
void display();
void menu_choice();
void mem_allocation();
int check_num(int n);
void error_message(int n);
void temp();
void mem_combine();
void move_disk();
void mem_recycle();
void dis_MAT(); /*函数说明*/
typedef struct Mem_list
{
int num; int status;
float size; float addr;
struct Mem_list *next;
}ML,*MLP;
MLP u_lst,f_lst;
void main() /*主函数*/
{
f_lst=(ML *)malloc(LEN);
u_lst=(ML *)malloc(LEN); /*初始化*/
u_lst->num=0;
u_lst->size=0;
u_lst->addr=0;
u_lst->status=1;
f_lst->num=0;
f_lst->size=MAXSIZE;
f_lst->addr=0;
f_lst->status=0;
f_lst->next=NULL;
display();
menu_choice();
return;
}
void display() /*菜单显示函数*/
{
printf("\n===============MemoryFunction-Munu================\n");
printf("1. Memory Allocation ");
printf("2. Memory Recycle\n");
printf("3. Display MAB");
printf("4. Memory Combine\n");
printf("5. Clear_Screen&Display_menu ");
printf("6. Quit\n");
return;
}
void menu_choice() /*菜单选择函数*/
剩余13页未读,继续阅读
- 义博云天2013-06-08如果有个图像界面的代码 更好
- 粉丝: 1
- 资源: 9
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助