【正文】
case 6:save(head)。 case 2:print( )。gotoxy(1,7)。textcolor(BLUE)。 ptr2next=ptr1。 ptr2=ptr1。 return(NULL)。 scanf(%s,filename1)。 getch( )。 printf(Please input saved goods39。 printf(goodsnumber goodsname goodscount\n\n)。 ptr1=head。 gotoxy(18,10)。 printf(Cotinue to search?(yes or no):)。ptr1num!=sel_numamp。 scanf(%s,name)。sel)。 gotoxy(5,4)。 long int sel_num。 printf(Press any key to back to last Menu\n)。t find this goodsmessage!\n\n)。strcmp(ptr1name,name)!=0) {ptr2=ptr1。sel!=2)。 case 2:clrscr( )。 scanf(%d,amp。 printf(Please input delected goods39。 gotoxy(20,10)。 printf(And make sure to Save(6) them or you will lose them!\n)。 scanf(%s,judge)。 ptr1=head。flushall( )。 flushall( )。 printf(Please input inserted goods39。 char judge[10]。 printf(Finish the inputting of goods39。%s:\n,n,string3)。 if(ptr1num==0) {ptr1num=NULL。 ptr2=ptr1。ptr1count)。 } printf(Please input the No.%d goods39。%s:\n,n,string1)。 char string2[ ]={name}。 /*保存貨品信息*/COM *openfile( )。 int count。如何編寫符合要求的程序、如何編寫高質(zhì)量的程序更是我們所面臨的難題。7.COM *openfile( )載入模塊用于調(diào)用。輸入條件:調(diào)用載入模塊。輸入條件: goodsnumb ld型,且0. 當=0時退出 goodsname s 型 goodscount d型,且0. 當0時顯示輸入錯誤,重輸字樣。使之指向被刪除結(jié)點的后面一個結(jié)點即可。用malloc函數(shù)開辟一個結(jié)點,并使ptr1,ptr2都指向它,之后從鍵盤讀入一個貨品的數(shù)據(jù)給ptr1所指向的結(jié)點。三、詳細設(shè)計(1)數(shù)據(jù)結(jié)構(gòu)的選擇選取動態(tài)數(shù)據(jù)結(jié)構(gòu),本系統(tǒng)是通過雙向鏈表來完成的。刪除可以按照貨品編號和貨品名稱兩中方法進行。計算機科學各領(lǐng)域及有關(guān)的應(yīng)用軟件都要用到數(shù)據(jù)結(jié)構(gòu)。分模塊對題目進行設(shè)計,強化學生對C語言的掌握和對數(shù)據(jù)結(jié)構(gòu)的選擇及掌握。每個貨品的相關(guān)信息包括:貨品號、貨品名、貨品庫存量、進貨日期、貨品生產(chǎn)廠家及供應(yīng)商等。它又是操作系統(tǒng)、編譯原理、數(shù)據(jù)庫原理、算法分析、人工智能、圖象處理等專業(yè)課程的前導課。當輸入的貨品編號為0時,輸入結(jié)束。保存。首先設(shè)三個指針變量:head,ptr1,ptr2。建立鏈表過程至此結(jié)束,ptr1最后所指結(jié)點并未鏈入鏈表中。前面已經(jīng)表明本系統(tǒng)的數(shù)據(jù)結(jié)構(gòu)選取動態(tài)數(shù)據(jù)結(jié)構(gòu)——雙向鏈表,因此此列表在內(nèi)存中是以鏈表的形式存儲的。goos’filename:d:\pll\fu按貨品名的number, name, count 分別輸入,如輸錯則有信息提示。goos’filename:d:\pll\fu有兩種查找方式按號和名查找,如輸錯則有信息提示。程序的實現(xiàn)不是一時愛好就可以完成的。其實,最主要的一點還是要認真勤奮,為自己的目標而不怕困難不斷前進,這不只是對程序設(shè)計而言,學習其他所有的東西都應(yīng)如此。 /*插入貨品信息*/COM *delet( )。char filename1[10]。 /*無回顯的從鍵盤讀取任意一個字符*/ } clrscr( )。 getch( )。 /*刷新緩沖區(qū)函數(shù)*/ printf(Please input the No.%d goods39。 else ptr2next=ptr1。 scanf(%ld,amp。ptr1name)。 }while(CHECK_COUNT)。 char string1[ ]={goodsnumber}。 head=openfile( )。%s(0):\n,string1)。%s:\n,string2)。 flushall( )。ptr3prior=ptr2。 gotoxy(18,11)。 int sel。 if(head==NULL) return(NULL)。 printf( * depend on goodsname\n)。 scanf(%d,amp。 break。amp。 free(ptr1)。 gotoxy(20,10)。} /*查找模塊*/void search( ){char name[10]。 head=openfile( )。 gotoxy(10,22)。 break。 ptr1=head。 printf(PRINT)。 getch( )。 else clrscr( )。 getch( )。 getch( )。 return。 printf(Saving success!Press any key to back to last Menu:)。 return(NULL)。 else { do {if(n==1) head=ptr1。 getch( )。int sel。printf( Please press any key into the Menu!)。sel)。 /*刪除模塊*/ break。}}while(sel!=0)。 /*插入模塊*/ break。printf(please choose a number from 0 to 6:)。printf(%s,message)。} /*關(guān)閉文件函數(shù)*/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 messa