标签:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
#include<stdio.h> #include<conio.h> #include<string.h> #define MAX 24 struct partition{ char pn[10]; int begin; int size; int end; int name; char status; }; typedef struct partition PART; int n; void choose(); //选择界面 void judge(); //判断 void FirstFit(); //最快适应算法 void CyclicFirstFit(); //循环首次适应算法 void BestFit(); //最佳适应算法 void BadFit(); //最坏适应算法 void main() { struct partition PART; int n; printf ( "初始化,设内存总容量512k\n" ); printf ( "系统从低地址部分开始使用,占用100k\n" ); printf ( "输入标号:" ); scanf ( "%d" ,&n); printf ( "输入开始大小:" ); scanf ( "%d" ,&PART.begin); printf ( "输入占用大小:" ); scanf ( "%d" ,&PART.size); printf ( "空闲区表Free:\n" ); printf ( " no.\tproname\tbegin\tsize\tstatus\t\n" ); printf ( " no.%d\t---\t%d\t%d\tf\t\n" ,n,PART.begin,PART.size); printf ( "-----------------------------------------------\n" ); printf ( "输入标号:" ); scanf ( "%d" ,&n); printf ( "输入开始大小:" ); scanf ( "%d" ,&PART.begin); printf ( "输入占用大小:" ); scanf ( "%d" ,&PART.size); printf ( "已分配分区表Free:\n" ); printf ( " no.\tproname\tbegin\tsize\tstatus\t\n" ); printf ( " no.%d\tSYSIEM\t%d\t%d\tu\t\n" ,n,PART.begin,PART.size); printf ( "-----------------------------------------------\n" ); printf ( "输入标号:" ); scanf ( "%d" ,&n); printf ( "输入开始大小:" ); scanf ( "%d" ,&PART.begin); printf ( "输入占用大小:" ); scanf ( "%d" ,&PART.size); printf ( "内存使用情况Free:\n" ); printf ( " no.\tproname\tbegin\tsize\tstatus\t\n" ); printf ( " no.%d\tSYSIEM\t%d\t%d\tu\t\n" ,n,PART.begin,PART.size); choose(); } void choose() { int i; printf ( "\n1.首次适应算法" ) ; printf ( "\n2.循环首次适应算法" ) ; printf ( "\n3.最佳适应算法" ) ; printf ( "\n4.最坏适应算法" ); scanf ( "%d" ,&i) switch (i){ case 1: FirstFit(); break ; case 2: CyclicFirstFit(); break ; case 3: BestFit(); break ; case 4: BadFit(); break ; } void judge() { } |
标签:
原文地址:http://www.cnblogs.com/dalaotan/p/5593653.html