【正文】
}}while(sel!=0)。 /*保存模塊*/ break。 /*查找模塊*/ break。 /*刪除模塊*/ break。 /*插入模塊*/ break。 /*輸出模塊*/ break。 /*輸入模塊*/ break。sel)。printf(please choose a number from 0 to 6:)。printf(%s,menu)。do{clrscr( )。printf( Please press any key into the Menu!)。printf(%s,message)。 /*背景為銀灰色,字為藍色*/clrscr( )。textbackground(LIGHTGRAY)。int sel。} /*關閉文件函數*/void main( ){char message[ ]={ *The instruction of GOODS SYSTEM* \n\n You can input many kinds of messages,and you can use \n goodname as FILEname \n This SYSTEM can do operation like insert or delect to the \n goodsmessage that have saved,then saved you \n can search message depend on the goodsnub or goodsname. \n\n\n *Wele to enter the GOODS SYSTEM!* \n }。 }return(head)。 } }while(ptr1next!=NULL)。 getch( )。return(NULL)。 if((ptr1=(COM*)malloc(LEN))==NULL) {printf(No enough memory,fail to creat linklist!\nPlease press any key to back to Menu\n)。 n=n+1。 else { do {if(n==1) head=ptr1。 return(NULL)。 } if(fread(ptr1,sizeof(COM),1,fp)!=1) /*從fp指向的流中讀取1個字段,每個字段為COM的字符長,并把它們放到ptr1指向的字符數組中,文件的位置指示器隨著所讀取的字符數而下移*/ {printf(Fail to print message from FILE!\nPlease press any key back to Menu\n)。 getch( )。 return(NULL)。t exist,please check if exist.\npress any key back to Menu)。 if((fp=fopen(strcat(filename1,filename2),rb))==NULL) {gotoxy(15,13)。}/*載入模塊*/COM * openfile( ){int n=1。 printf(Saving success!Press any key to back to last Menu:)。 } fclose(fp)。 return。 while(ptr1!=NULL) {if(fwrite(ptr1,sizeof(COM),1,fp)!=1) {printf(Fail to print message to FILE!)。 return。 if((fp=fopen(strcat(filename1,filename2),wb))==NULL) /*以二進制只寫方式打開一個流*/ {printf(Fail to creat FILE!)。filename(limit to letter or number):)。 gotoxy(8,13)。 getch( )。 gotoxy(10,24)。 } i=i+1。 gotoxy(0,6)。 getch( )。 if(i/10==1) /*超過十行換頁*/ {i=0。 do {printf(PRINT)。 printf(goodsnumber goodsname goodscount\n\n)。 else clrscr( )。 head=openfile( )。 printf(Please input printed goods39。 clrscr( )。 getch( )。 gotoxy(10,24)。 scanf(%s,judge)。t find this goodsmessage!\n\n)。 printf(PRINT)。 if ((ptr1num==sel_num)||(strcmp(ptr1name,name)==0)) {printf(\n Success to search goodsmessage!\n)。amp。amp。 ptr1=head。amp。 break。 printf(Please input goodsname:)。 break。 scanf(%ld,amp。 switch(sel) {case 1:clrscr( )。 scanf(%d,amp。 gotoxy(10,22)。 printf( * depend on goodsnumber\n)。 printf(Please choose the way to search:)。 else do {do {clrscr( )。 head=openfile( )。 printf(Please press searched goods39。 clrscr( )。 int sel。} /*查找模塊*/void search( ){char name[10]。 getch( )。 gotoxy(16,12)。 gotoxy(18,11)。 gotoxy(20,10)。 }while(!strcmp(judge,yes))。 } printf(Cotinue to delect?(yes or no):)。 } else printf(\nCan39。 free(ptr1)。} if(ptr1num==del_num||(strcmp(ptr1name,name)==0)) {ptr2next=ptr1next。 ptr1=ptr1next。amp。amp。 printf(Success to delect goodsmessage!\n)。