產(chǎn)品進銷存管理系統(tǒng) 課程設(shè)計報告書
《產(chǎn)品進銷存管理系統(tǒng) 課程設(shè)計報告書》由會員分享,可在線閱讀,更多相關(guān)《產(chǎn)品進銷存管理系統(tǒng) 課程設(shè)計報告書(17頁珍藏版)》請在裝配圖網(wǎng)上搜索。
1、中北大學(xué)數(shù) 據(jù) 結(jié) 構(gòu)課 程 設(shè) 計 說 明 書學(xué)生姓名:宋立群學(xué) 號:1021011803學(xué) 院:軟件學(xué)院專 業(yè):軟件開發(fā)與測試題 目:產(chǎn)品進銷存管理系統(tǒng)指導(dǎo)教師何志英2011年12月20日0 / 17(一)設(shè)計任務(wù)概述針對某一種行業(yè)的庫房的產(chǎn)品進銷存情況進行管理。1、采用一定的存儲結(jié)構(gòu)對庫房的貨品及其數(shù)量進行分類管理;運用鏈表進行存儲,同時用到指針變量,運用循環(huán)存儲,對存儲產(chǎn)品的信息要用到日期結(jié)構(gòu)體和產(chǎn)品結(jié)構(gòu)體,對存儲要用到文件指針以及文件的一些方法的使用。2、可以進行產(chǎn)品類的添加、產(chǎn)品的添加、產(chǎn)品數(shù)量的添加; 首先要找到鏈表的指針變量,對指針變量進行修改,然后再進行產(chǎn)品的出入。3、能夠查
2、詢庫房每種產(chǎn)品的總量、進貨日期、銷出數(shù)量、銷售時間等; 首先要定義一個查詢函數(shù),對產(chǎn)品類的指針變量進行循環(huán)查詢,再對產(chǎn)品的指針變量進行循環(huán)查詢,找到產(chǎn)品時,在調(diào)用顯示產(chǎn)品信息函數(shù),顯示查詢到的產(chǎn)品的各項信息。(二)本設(shè)計所采用的數(shù)據(jù)運用鏈表進行存儲,同時用到指針變量,循環(huán)存儲(三)功能模塊詳細設(shè)計3.1詳細設(shè)計思想1、順序表掛接鏈表的抽象定義類型:ADT sqmountlink 數(shù)據(jù)對象:D=ai|aikindlist,i=1,2,n,n=0 數(shù)據(jù)關(guān)系:R=|ai-1,aiD,i=1,2,3,n 基本操作: InitMountLisr(&L) 操作結(jié)果:構(gòu)造一個空的順序表掛接鏈表L。 Kind
3、Insert(&L,n) 初始條件:順序表掛接鏈表L已存在。 操作結(jié)果:向順序表掛接鏈表L中添加N類產(chǎn)品ProductInsert(&L,I,n) 初始條件:順序表掛接鏈表L已存在且要將產(chǎn)品插入的產(chǎn)品類i已存在 操作結(jié)果:向順序表掛接鏈表L中的產(chǎn)品類i中添加N種產(chǎn)品ProQuantity_add(&L,I,e,n) 初始條件:順序表掛接鏈表L已存在且需要添加的產(chǎn)品及產(chǎn)品所屬的類也存在 操作結(jié)果:添加順序表掛接鏈表L的產(chǎn)品類i中的產(chǎn)品e的數(shù)量Visit(&L,i,e) 初始條件:順序表掛接鏈表L已存在且待查詢的產(chǎn)品所屬產(chǎn)品類i也存在 操作結(jié)果:在順序表掛接鏈表L中查詢產(chǎn)品e的各項信息Displa
4、yList(&L) 初始條件:順序表掛接鏈表L已存在 操作結(jié)果:現(xiàn)實順序表掛接鏈表L的內(nèi)容3.2核心代碼#include#include#include#define ok 1#define error 0#define overflow 0#define SQMOUNTLINK_INIT_SIZE 100#define SQMOUNTLINKINCREMENT 10typedef struct date int year; int month; int day;date; /日期typedef struct productlnode char pname30; /產(chǎn)品名稱 int total
5、quantity; /產(chǎn)品總量 date goodsdate; /進貨日期 int salesquantity; /消除數(shù)量 date salestime; /銷售時間 struct productlnode *nextproduct;productlnode,*plinklist;typedef struct kindlnode productlnode *firstproduct; char pkindname30;kindlnode;typedef struct kindlnode *kindelem; int length; int listsize;sqmountlink;int I
6、nitMountList(sqmountlink &L) /初始化一個空的順序表掛接鏈表L int i; L.kindelem=(kindlnode*)malloc(SQMOUNTLINK_INIT_SIZE*sizeof(kindlnode); if(!L.kindelem) exit(overflow); L.length=0; L.listsize=SQMOUNTLINK_INIT_SIZE; for(i=0;i=L.listsize) newbase=(kindlnode*)realloc(L.kindelem,(L.listsize+n)*sizeof(kindlnode); if(
7、!newbase) exit(overflow); L.kindelem=newbase; L.listsize+=n; printf(需添加的產(chǎn)品類名稱:n); for(i=0;in;i+) scanf(%s,&L.kindelemL.length.pkindname); L.kindelemL.length.firstproduct=NULL; L.length+; return ok;/KindInsertint ProductInsert(sqmountlink &L,char pkindname2,int n) /向順序表掛接鏈表L的某產(chǎn)品類中添加N個產(chǎn)品 plinklist p,q
8、; int k,j; for(k=0;kpname),&(q-totalquantity),&(q-goodsdate).year),&(q-goodsdate).month),&(q-goodsdate).day),&(q-salesquantity),&(q-salestime).year),&(q-salestime).month),&(q-salestime).day); q-nextproduct=NULL; (L.kindelemk).firstproduct=q; for(j=1;jpname),&(p-totalquantity),&(p-goodsdate).year),&(
9、p-goodsdate).month),&(p-goodsdate).day),&(p-salesquantity),&(p-salestime).year),&(p-salestime).month),&(p-salestime).day); p-nextproduct=q-nextproduct; q-nextproduct=p; q=p; else for(q=L.kindelemk.firstproduct; ;q=q-nextproduct) if(!(q-nextproduct) break; printf(需添加產(chǎn)品的名稱、總量、進貨日期、銷售數(shù)量、銷售時間:n); for(j=
10、0;jpname),&(p-totalquantity),&(p-goodsdate).year),&(p-goodsdate).month),&(p-goodsdate).day),&(p-salesquantity),&(p-salestime).year),&(p-salestime).month),&(p-salestime).day); p-nextproduct=q-nextproduct; q-nextproduct=p; q=p; return ok;/ProductInsertvoid ProQuantity_add(sqmountlink &L,char pkindname
11、1,char pname1,int n) /添加順序表掛接鏈表L的某產(chǎn)品類中的某產(chǎn)品的總量,且需添加的產(chǎn)品總量為n int i,k; plinklist p; for(i=0;iL.length;i+) if(strcmp(L.kindelemi).pkindname,pkindname1)!=0) continue; else break; if(inextproduct) k=strcmp(p-pname,pname1); if(k=0) p-totalquantity=p-totalquantity+n; printf(查看添加后產(chǎn)品的各項輸出:%s %d %d,%d,%d %d %d,
12、%d,%dn,p-pname,p-totalquantity,(p-goodsdate).year,(p-goodsdate).month,(p-goodsdate).day,p-salesquantity,(p-salestime).year,(p-salestime).month,(p-salestime).day); /ProQuantity_addvoid ProQuantity_subtract(sqmountlink &L,char pkindname4,char pname4,int n) /添加順序表掛接鏈表L的某產(chǎn)品類中的某產(chǎn)品銷出數(shù)量,且銷出的數(shù)量n int i,k; pl
13、inklist p; for(i=0;iL.length;i+) if(strcmp(L.kindelemi).pkindname,pkindname4)!=0) continue; else break; if(inextproduct) k=strcmp(p-pname,pname4); if(k=0) p-salesquantity=p-salesquantity+n; printf(查看添加后產(chǎn)品的各項輸出:%s %d %d,%d,%d %d %d,%d,%dn,p-pname,p-totalquantity,(p-goodsdate).year,(p-goodsdate).month
14、,(p-goodsdate).day,p-salesquantity,(p-salestime).year,(p-salestime).month,(p-salestime).day); /ProQuantity_subtractvoid Visit(sqmountlink &L,char pkindname3,char pname3) /在順序表掛接鏈表L中,查詢屬于某產(chǎn)品類的某產(chǎn)品的各項信息 int i,k; plinklist p; for(i=0;iL.length;i+) if(strcmp(L.kindelemi).pkindname,pkindname3)!=0) continu
15、e; else break; if(inextproduct) k=strcmp(p-pname,pname3); if(k=0) break; if(k!=0) printf(此產(chǎn)品不存在:n); else printf(輸出待查詢產(chǎn)品的各項信息:n); printf(產(chǎn)品類產(chǎn) 品產(chǎn)品總量進 貨 日 期銷售數(shù)量銷 售 時 間n); printf(%s %s %d %d,%d,%d %d %d,%d,%dn,(L.kindelemi).pkindname,p-pname,p-totalquantity,(p-goodsdate).year,(p-goodsdate).month,(p-good
16、sdate).day,p-salesquantity,(p-salestime).year,(p-salestime).month,(p-salestime).day); /Visitvoid DisplayList(sqmountlink &L) /顯示各產(chǎn)品所屬產(chǎn)品類、產(chǎn)品名稱、產(chǎn)品總量、進貨日期、銷售數(shù)量、銷售時間 int i; plinklist p; printf(產(chǎn)品類產(chǎn) 品產(chǎn)品總量進 貨 日 期銷售數(shù)量銷 售 時 間n); for(i=0;inextproduct) printf(%s %s %d %d,%d,%d %d %d,%d,%dn,(L.kindelemi).pkind
17、name,p-pname,p-totalquantity,(p-goodsdate).year,(p-goodsdate).month,(p-goodsdate).day,p-salesquantity,(p-salestime).year,(p-salestime).month,(p-salestime).day); /DisplayListvoid menu_operation()/操作菜單 printf(n); printf(輸入所要執(zhí)行的操作:n); printf(1、產(chǎn)品類添加: n); printf(2、產(chǎn)品添加: n); printf(3、產(chǎn)品數(shù)量添加: n); printf(4
18、、產(chǎn)品售出: n); printf(5、查詢產(chǎn)品: n); printf(0、退出程序: n); printf(n);/mene_operation/*-主程序-*/void main(void) int order; int i,n; char a30; char b30; sqmountlink L; InitMountList(L); printf(輸入時間時請按照“年,月,日”格式輸入.n); loop: menu_operation(); printf(輸入命令:); scanf(%d,&order); switch(order) case 1: printf(需添加產(chǎn)品類的個數(shù):)
19、; scanf(%d,&i); KindInsert(L,i); printf(修改后的產(chǎn)品庫存管理表:n); DisplayList(L); goto loop; case 2: printf(需添加產(chǎn)品所屬產(chǎn)品類的名稱:); scanf(%s,&a); printf(需向此產(chǎn)品類添加產(chǎn)品的個數(shù):); scanf(%d,&i); ProductInsert(L,a,i); printf(修改后的產(chǎn)品庫存管理表:n); DisplayList(L); goto loop; case 3: printf(輸入需添加數(shù)量的產(chǎn)品所屬產(chǎn)品類的名稱:); scanf(%s,&a); printf(輸入需
20、添加數(shù)量的產(chǎn)品的名稱:); scanf(%s,&b); printf(輸入需添加產(chǎn)品的數(shù)量:); scanf(%d,&n); ProQuantity_add(L,a,b,n); printf(修改后的產(chǎn)品庫存管理表:n); DisplayList(L); goto loop; case 4: printf(輸入售出產(chǎn)品所屬產(chǎn)品類的名稱:); scanf(%s,&a); printf(輸入售出產(chǎn)品的名稱:); scanf(%s,&b); printf(輸入售出產(chǎn)品的數(shù)量:); scanf(%d,&n); ProQuantity_subtract(L,a,b,n); printf(修改后的產(chǎn)品庫存
21、管理表:n); DisplayList(L); goto loop; case 5: printf(輸入待查詢產(chǎn)品所屬產(chǎn)品類的名稱:); scanf(%s,&a); printf(輸入待查詢產(chǎn)品的名稱:); scanf(%s,&b); Visit(L,a,b); goto loop; case 0: exit(0); 3.3程序運行結(jié)果 程序啟動界面。產(chǎn)品類的添加。產(chǎn)品的添加。產(chǎn)品數(shù)量的添加。 產(chǎn)品售出。產(chǎn)品查詢。 (四) 課程設(shè)計心得,存在問題及解決方法 拿到這道題時,我沒有選擇自己去編寫,我想我從來沒有編過這么復(fù)雜的程序,一定編不成,我選擇了上網(wǎng)去查,值得慶幸的是我找到了一部分的程序,然后
22、拷貝上程序在機房運行,發(fā)現(xiàn)有許多錯誤,我就開始一個一個解決問題,其中有些問題是一些符號的丟失,還有頭文件的錯誤運用,還有對一些輸入超出程序范圍的數(shù)據(jù)進行修改,才使程序得以繼續(xù)進行,最后我通過自己和請教同學(xué),最終整個程序得以運行,不過最重要的不是僅僅讓程序運行成功,而是了解整個程序的思想設(shè)計和功能的實現(xiàn),然后我開始翻譯程序,把每一句都弄的清清楚楚為止,從中我復(fù)習(xí)了很多知識點,也學(xué)到了很多我以前不知道的東西。通過對本系統(tǒng)的開發(fā),我對軟件開發(fā)過程有了更清楚地了解,首先是問題的定義,需求分析,然后概要設(shè)計,詳細設(shè)計等,讓我知道了僅僅學(xué)習(xí)課本知識是不行的,還得經(jīng)常去自己設(shè)計一些小的項目去發(fā)現(xiàn)問題,必須培養(yǎng)動手能力,這樣才能既復(fù)習(xí)了知識點,又可以學(xué)會詳細的數(shù)據(jù)結(jié)構(gòu)思想和設(shè)計,所以我在以后一定要加強這方面的學(xué)習(xí)。 溫馨提示:最好仔細閱讀后才下載使用,萬分感謝!
- 溫馨提示:
1: 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
2: 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
3.本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
5. 裝配圖網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 電功電功率專題
- 高中生物會考第八講基因?qū)π誀畹目刂?/a>
- 的價值訴求——我讀2011版《義務(wù)教育語文課程標準》
- 新標準小學(xué)英語第二冊M4 U1 Do you like meat
- 《五柳先生傳》課件 (2)
- 天然放射性元素化學(xué)
- 家風(fēng)家訓(xùn)班會課件
- 五指山紅色文化主題公園項目策劃方案通用課件
- 戴明領(lǐng)導(dǎo)手冊總活動
- 6通信局(站)的防雷與接地
- 管腔類器械的清洗PPT通用課件
- 八年級歷史上冊第七單元解放戰(zhàn)爭第24課人民解放戰(zhàn)爭的勝利習(xí)題課件新人教版
- 高等代數(shù)北大版4-7
- 金融系各科課件初級宏觀-2
- 精品:課件 (18)