}
display(){
TABLE *pt=tab;
if(pt==NULL) return 0;
printf(\¿ÕÏзÖÇøÇé¿ö---------\\n\ printf(\״̬\\t´óС\\tÆðʼµØÖ·\\n\ while(pt!=NULL){
printf(\ pt=pt->next; } return 0; }
sorttable(){ /*·ÖÇø°´ÉýÐòÅÅÁÐ*/ TABLE *first, *second; if(tab==NULL){ p->next=tab; tab=p; } else{ first=tab;
second=first->next; while(second!=NULL){ first=first->next;
second=second->next; }
first->next=p; } }
InitTab(){ int num;
int i,paddr=0;
TABLE *pn; /*Ö¸ÏòÇ°Ò»½áµã*/ pn=NULL;
printf(\ printf(\ÇëÊäÈë·ÖÇø¸öÊý:\\n\ scanf(\ for(i=0;i p=getpch(TABLE); printf(\ÊäÈë·ÖÇøNO.%dµÄID:\\n\ scanf(\ p->state='N'; printf(\ÊäÈë·ÖÇø´óС:\\n\ scanf(\ p->addr=paddr; paddr=p->addr+p->size; p->prev=pn; pn=p; p->next=NULL; sorttable(); /* °´·ÖÇøÆðʼµØÖ·ÅÅÐò*/ } } main(){ int ch=1; int size; char name[10],c='y'; UI(); InitTab(); system(\ UI(); display(); getch(); system(\ while(c!='n'&&c!='N'){ UI(); printf(\Ñ¡ÔñÄãÒª½øÐеIJÙ×÷\\n1--·ÖÅä×÷Òµ\\n2--»ØÊÕ·ÖÇø\\n0/ÆäËû--Í˳ö\\n\\n\ scanf(\system(\switch(ch) { case 1: UI(); display(); printf(\ÇëÊäÈë×÷Òµ´óС:\\n\scanf(\allocate(size); break; UI(); display(); printf(\ÇëÊäÈë´ý»ØÊÕ·ÖÇøµÄID:\\n\scanf(\ case 2: recycle(name); break; case 0: } ½Ø } default :exit(0); } display(); printf(\ÊÇ·ñ¼ÌÐø?y/n\\n\system(\ c=getch(); ͼ£º Î塢ʵÑéС½á ´Ë´ÎʵÑé, ¶¯ÊÖʵ¼ùÄ£ÄâÔÚÁ¬Ðø·ÖÅäÓë·ÖÒ³¹ÜÀíÁ½ÖÖ·½Ê½Ï£¬Ö÷´æ¿Õ¼äµÄ·ÖÅäÓë»ØÊÕ£¬¼ÓÉîÁ˽â´æ´¢Æ÷¹ÜÀíµÄ¹¤×÷¹ý³Ì¡£³¢ÊÔ²ÉÓÃÊ×´ÎÊÊÓ¦Ëã·¨¡¢Ñ»·Ê×´ÎÊÊÓ¦Ëã·¨¡¢×î¼ÑÊÊÓ¦Ëã·¨ÆäÖеÄÒ»ÖÖ»ò¶àÖÖË㷨ʵÏÖ¶¯Ì¬·ÖÇø·ÖÅä,·ÖҳʽÖ÷´æ¹ÜÀíϵͳµÈµÈ.ʵÑé¹ý³ÌÖÐ,Éî¿ÌÁ˽âÁË·ÖҳʽÓëÁ¬Ðøʽ֮¼äµÄÇø±ðÓëÏàËÆ´¦,¸üºÃµÄ¶ÔÖ÷´æ¹ÜÀí¡¢»ØÊÕ¡¢×°ÈëµÈµÈÓÐÁ˸ü¼ÓÉîÈëµÄÁ˽â.