【正文】
0,22)。 scanf(%d,amp。 switch(sel) {case 1:clrscr( )。 printf(Please input goodsnumber:)。del_num)。 case 2:clrscr( )。 printf(Please input goodsname:)。name)。 } }while(sel!=1amp。sel!=2)。 if(ptr1num==del_num||(strcmp(ptr1name,name)==0)) { head=ptr1next。 } else /*判斷是否是目標(biāo)結(jié)點(diǎn)*/ { while(ptr1!=NULLamp。ptr1num!=del_numamp。strcmp(ptr1name,name)!=0) {ptr2=ptr1。ptr1prior=ptr2。 ptr1nextprior=ptr1prior。 printf(\nSuccess to delect goodsmessage!\n\n)。t find this goodsmessage!\n\n)。 scanf(%s,judge)。 clrscr( )。 printf(Delecting success!\n)。 printf(Press any key to back to last Menu\n)。 printf(And make sure to Save(6) them or you will lose them!\n)。 return(head)。 char judge[10]。 long int sel_num。 gotoxy(18,10)。fliename:)。 if(head==NULL) return。 gotoxy(5,4)。 gotoxy(1,9)。 printf( * depend on goodsname\n)。 printf(please choose a number between 1 and 2:)。sel)。 printf(Please input goodsnumber:)。sel_num)。 case 2:clrscr( )。 scanf(%s,name)。 } }while(sel!=1amp。sel!=2)。 while(ptr1!=NULLamp。ptr1num!=sel_numamp。strcmp(ptr1name,name)!=0) ptr1=ptr1next。 printf(goodsnumber goodsname goodscount\n\n)。 } else printf(\nCan39。 printf(Cotinue to search?(yes or no):)。 }while(!strcmp(judge,yes))。 printf(Please press any key to back to last Menu:)。 }/*輸出模塊*/void print( ) {int i=1。 gotoxy(18,10)。filename:)。 if(head==NULL) return。 printf( The printed result as follows:\n)。 ptr1=head。 ptr1=ptr1next。 printf(Press any key to change page:)。 clrscr( )。 printf(goodsnumber goodsname goodscount\n\n)。 }while(ptr1!=NULL)。 printf(Please press any key to back to last Menu:)。 }/*保存模塊*/void save(COM *head){ clrscr()。 printf(Please input saved goods39。 scanf(%s,filename1)。 getch( )。 } ptr1=ptr2=head。 getch( )。 } ptr1=ptr1next。 gotoxy(10,24)。 getch()。 scanf(%s,filename1)。 printf(This filename isn39。 getch( )。 } if((ptr1=ptr2=(COM*)malloc(LEN))==NULL) {printf(No enough memory,fail to creat linklist!\nPlease press any key back to Menu\n)。 return(NULL)。 getch( )。 } if(ptr1next==NULL) head=ptr1。 else ptr2next=ptr1。 ptr2=ptr1。 getch( )。 } if(fread(ptr1,sizeof(COM),1,fp)!=1) {printf(Fail to print message from FILE!\nPlease press any key to back to Menu\n)。return(NULL)。 ptr2next=ptr1。fclose(fp)。char menu[ ]={ ******************MENU******************** \n\n\n * \n * \n * \n * \n * \n * \n * \n}。delay(10)。textcolor(BLUE)。gotoxy(4,8)。gotoxy(10,22)。getch( )。gotoxy(1,7)。gotoxy(10,20)。scanf(%d,amp。switch(sel){case 1:head=input( )。 case 2:print( )。 case 3:head=insert( )。 case 4:head=delet( )。 case 5:search( )。 case 6:save(head)。 case 0:break。}七、附錄 所用到的參考文獻(xiàn): 1. 數(shù)據(jù)結(jié)構(gòu)課程設(shè)計(jì) 機(jī)械工業(yè)出版社 蘇仕華等 編著 2. 數(shù)絕結(jié)構(gòu)(c語言版) 清華大學(xué)出版社 嚴(yán)蔚敏 吳偉民 編者 25