商場收銀系統(tǒng)_第1頁
商場收銀系統(tǒng)_第2頁
商場收銀系統(tǒng)_第3頁
已閱讀5頁,還剩17頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、課程設(shè)計課程名稱C語言程序設(shè)計課程設(shè)計 A題目名稱商場收銀系統(tǒng)目錄1 系統(tǒng)分析 1.1.1 課程設(shè)計內(nèi)容 1.1.2 系統(tǒng)功能需求分析 1.1.3 數(shù)據(jù)結(jié)構(gòu)設(shè)計 錯. 誤 !未定義書簽。2 系統(tǒng)設(shè)計 2.2.1 總體設(shè)計 2.2.2 詳細設(shè)計 界面設(shè)計 各功能模塊的設(shè)計 4.3 系統(tǒng)編碼設(shè)計 5.3.1 main 函數(shù) 5.4 系統(tǒng)運行 1.3.5 總結(jié) 1.7.1 系統(tǒng)分析1.1 課程設(shè)計內(nèi)容 建立一商品信息文件,商品信息包括商品編號、商品名、商品類別、商品數(shù)量、 商品價格等。建立一商場收銀系統(tǒng),功能包括:1. 系統(tǒng)登錄:運行系統(tǒng)時,收銀員應(yīng)輸入姓名(或編號)

2、及密碼,驗證后方可 使用系統(tǒng)。2. 收銀操作:收銀員逐條輸入商品編號及數(shù)量,系統(tǒng)自動計算金額,輸入完畢 后顯示應(yīng)付款,當(dāng)輸入實收額后,計算出找贖值。3. 交易完成后按一定格式顯示回單(格式參照一般超市中的打印小票) 。4. 保存所顯示的回單。5. 自動按銷售情況更新商品信息文件中的數(shù)據(jù)。6. 查詢收銀員銷售信息。7. 瀏覽庫存商品信息。1.2 系統(tǒng)功能需求分析本系統(tǒng)應(yīng)具有以下功能:1、文件操作功能進行商品信息管理,以文本的形式保存商品最新信息2、數(shù)據(jù)輸入功能 個人登錄,消費商品基本資料的輸入,銷售信息輸入等3、數(shù)據(jù)添加、修改、刪除功能 商品數(shù)據(jù)更新,個人入庫信息修改更新4、計算功能基本計算功能

3、,銷售額處理5、查詢功能資料庫信息查詢7、數(shù)據(jù)顯示功能保障客戶知情權(quán),對系統(tǒng)輸入輸出信息的顯示2 系統(tǒng)設(shè)計2.1 總體設(shè)計按系統(tǒng)分析的功能要求將系統(tǒng)劃分為以下幾個主要功能模塊:1、建立新文本庫信息模塊2、銷售系統(tǒng)模塊3、商品銷售信息回單模塊4、商品庫更新模塊5、銷售回單保存模塊2.2 詳細設(shè)計2.2.1 界面設(shè)計1、菜單設(shè)計主菜單:子菜單:2、輸入界面的設(shè)計3、信息顯示界面的設(shè)計Mo .: ciinouiit: sum:0.00receive; change: 0.00Press any key to exit222各功能模塊的設(shè)計(這部分應(yīng)介紹各函數(shù)的根據(jù)劃分的功能模塊,定義以下函數(shù)實現(xiàn)各功

4、能:原型,各功能模塊實現(xiàn)所用的算法,可用流程圖描述)1、主函數(shù)main()2、charge 函數(shù)、receipt_m 函數(shù)銷售界面7商品信息錄入3、input_s 函數(shù)4、disp函數(shù)3系統(tǒng)編碼設(shè)計重要的代(這部分將代碼列出,注意,每個函數(shù)開始處要介紹函數(shù)的功能, 碼應(yīng)有注釋,代碼格式按鋸齒式編排)3.1 main 函數(shù)void mai n()/*主函數(shù):密碼登陸與主頁面顯示使用*/int key,j;int x,i;void openf();void newf();loop1:clrscr();gotoxy(10,4);for(i=0;i<20;i+)printf("# &q

5、uot;);gotoxy(10,16);for(i=0;i<20;i+)printf("# ");gotoxy(16,5);printf("this is the salesperson systemn");gotoxy(16,7);printf("1.please iput your number:n");gotoxy(16,8);scanf("%s",salesperson_num);gotoxy(16,9);printf("2.please input your key;n");go

6、toxy(16,10);scanf("%d",&key);for(j=0;j<3;j+) if(strcmp(salesperson_num,salespersonj.num)=0&&key=salespersonj.key) break;clrscr();printf("tyour number or key is wrongn");printf("tplease land againn");getch();goto loop1;3.2 clrscr 函數(shù)/* 主頁面顯示代碼,子函數(shù)選擇界面 */ go

7、toxy(16,8);printf("welcome to use the systemn");gotoxy(16,10);printf("press enter to continue");getch();doclrscr();gotoxy(10,5); for(i=0;i<20;i+) printf("* ");gotoxy(16,8);printf("1. build the goods warehouse"); gotoxy(16,9);printf("2. charge system&qu

8、ot;); gotoxy(16,10);printf("3. receipt message"); gotoxy(16,11);printf("4. add to goods message"); gotoxy(16,12);printf("5. sell message"); gotoxy(16,13);printf("6. display goods stock"); gotoxy(16,14);printf("7. exit"); gotoxy(10,16);for(i=0;i<20

9、;i+)printf("* "); gotoxy(16,18);printf("please select the menu:"); scanf("%d",&x);while(x<1|x>8);switch(x) case 1:newf(); break; case 2:charge();break; case 3:receipt_m();break; case 4:input_s();break; case 5:sell_m();break; case 6:disp();break; case 7:exit();

10、while(1);3.3 newf 函數(shù)*/*新建庫信息函數(shù),建立新文檔存儲更新商品信息void newf() void openf();int i,x;clrscr();do clrscr();gotoxy(10,5); for(i=0;i<20;i+) printf("* ");gotoxy(16,8);printf("1.the new warehouse filename n"); gotoxy(16,9);printf("2.add the goods message");gotoxy(16,10);printf(&q

11、uot;3.exit"); gotoxy(10,16); for(i=0;i<20;i+) printf("* "); gotoxy(16,18);printf("please select the menu:"); scanf("%d",&x);switch(x) case 1:openf(); break;case 2:input_s();break;case 3:exit(); while(1);void openf()int i;char f;clrscr();/*system("cls&qu

12、ot;);*/printf("tinput the warehouse filename pleasen"); scanf("%s",xname);fp=fopen("xname","a"); fp1=fopen("b.txt","w");fprintf(fp1,"%dt%d",n,n1); fclose(fp1);fp2=fopen("c.txt","w");fp3=fopen("d.txt",

13、"w");printf("tYou were built the warehouse n"); printf("ntcontinue to add goods message?(y/n)");f=getch();if(f='y')input_s();3.4 charge 函數(shù)/* 銷售信息管理系統(tǒng) */charge()int i,j,f;int No;float sum=0;float change,receive;clrscr();gotoxy(10,5);for(i=0;i<20;i+)printf(&quo

14、t;* ");fp1=fopen("b.txt","r"); fscanf(fp1,"%d%d",&n,&n1);fclose(fp1);if( fp=fopen("a.txt","r")!=NULL) for(i=0;i<n;i+) fscanf(fp,"%d%s%d%d",&goodsi.num,,&goodsi.price,&goodsi.amount);doprintf("ntNo

15、.:t");scanf("%d",&No);printf("ntamount:t");scanf("%d",&j);No-;n1+;goodsNo.amount-;sum+=j*goodsNo.price;fp2=fopen("c.txt","a");fprintf(fp2,"%st%dt%st%dt%dn",salesperson_num,goodsNo.num,goodsN,goodsN o.price,j);fclose(fp2);

16、fp3=fopen("d.txt","a");fprintf(fp3,"%dnt%d",goodsNo.num,j);fclose(fp3);f=getch();if(f=0)getch();break;while(1);printf("ntsum:t%5.2f",sum);printf("nntreceive:t");scanf("%f",&receive);change=receive-sum;printf("ntchange:t%5.2f",

17、change);fp3=fopen("d.txt","a");fprintf(fp3,"nt%5.2fnt%5.2fnt%5.2f",sum,receive,change);fclose(fp3);fp=fopen("a.txt","w");for(i=0;i<n;i+) fprintf(fp,"%dt%st%dt%dn",goodsi.num,,goodsi.price,goodsi.amount); fclose(fp);fp1=fopen(&

18、quot;b.txt","w");fprintf(fp1,"%dt%d",n,n1);fclose(fp1);gotoxy(10,20);for(i=0;i<20;i+)printf("* ");gotoxy(16,22);printf("Press any key to exit");getch();3.5 receipt 函數(shù)/* 客戶回單信息 */receipt_m()int i,No,j;float change,receive,sum;clrscr();gotoxy(10,5);for(i

19、=0;i<20;i+)printf("* ");fp1=fopen("b.txt","r");fscanf(fp1,"%d%d",&n,&n1);fclose(fp1);if( fp3=fopen("d.txt","r")!=NULL) for(i=0;i<n1;i+) fscanf(fp3,"%dt%dt%ft%ft%f",&goodsNo.num,&j,&sum,&receive,&c

20、hange); for(i=0;i<n1;i+)printf("ntNo:t%dntamount:t%dntsum:t%5.2fntreceive:%5.2fntchange:t%5.2fn",goods No.num,j,sum,receive,change);fclose(fp3);elseprintf("errorn");gotoxy(10,20);for(i=0;i<20;i+)printf("* ");gotoxy(16,22);printf("Press any key to exit");

21、getch();3.6 input 函數(shù)/* 庫存信息更新 */input_s()int i,f,j=0;clrscr();printf("tthis is the goods stock,please add the goods messagen");printf("num:name:price:amount:n");fp1=fopen("b.txt","r");fscanf(fp1,"%d%d",&n,&n1);fp=fopen("a.txt","

22、;a");for(i=0;i+,j+) scanf("%d%s%d%d",&goodsi.num,,&goodsi.price,&goodsi.amount); n+;fp1=fopen("b.txt","w");fprintf(fp1,"%dt%d",n,n1);fclose(fp1);printf("ncontinue?(y/n)");f=getch();if(f='n')break;for(i=0;i<=j;i+

23、)fprintf(fp,"%dt%st%dt%dn",goodsi.num,,goodsi.price,goodsi.amount); fclose(fp);gotoxy(16,20);printf("press any key to break");getch();3.7 sell 函數(shù)/* 顯示最近銷售信息 */ sell_m() int i,j,No;clrscr();gotoxy(10,5);for(i=0;i<20;i+)printf("* ");printf("ntsalesperso

24、n_numtnumtnametpricetsell_numn");fp1=fopen("b.txt","r");fscanf(fp1,"%d%d",&n,&n1);fclose(fp1);if( fp2=fopen("c.txt","r")!=NULL) for(i=0;i<n1;i+)fscanf(fp2,"%st%dt%st%dt%dn",salesperson_num,&goodsNo.num,goodsN,&

25、goods No.price,&j);for(i=0;i<n1;i+)printf("t%stt%dt%st%dt%dn",salesperson_num,goodsNo.num,goodsN,goodsNo. price,j);fclose(fp2);elseprintf("errorn");gotoxy(10,20);for(i=0;i<20;i+)printf("* ");gotoxy(16,22);printf("Press any key to exit");getch()

26、;3.8 display 函數(shù)/* 顯示最近銷售的庫存信息 */disp()int i;clrscr();gotoxy(10,5);for(i=0;i<20;i+)printf("* ");printf("ntinput the warehouse filenamen");gotoxy(10,7);scanf("%s",xname);printf("tNo.tnametpricetamountn");fp1=fopen("b.txt","r");fscanf(fp1,&

27、quot;%d",&n);if( fp=fopen(xname,"r")!=NULL) for(i=0;i<n;i+)fscanf(fp,"%d%s%d%d",&goodsi.num,,&goodsi.price,&goodsi.amount); for(i=0;i<n;i+) printf("t%dt%st%dt%dn",goodsi.num,,goodsi.price,goodsi.amount); fclose(fp);elseprintf("errorn");gotoxy(10,20);for(i=0;i<20;i+)printf("* ");gotoxy(16,22);printf("Press any key to exit");getch();4 系統(tǒng)運行(這部分介紹程序運行過程, 系統(tǒng)操作使用的說明, 使用測試數(shù)據(jù)運行的結(jié)果,可將運行結(jié)果截圖進行說明)密碼登陸界面菜單頁面銷售系統(tǒng)顯示界面銷售記錄商品信息添加26740Ion.dll 174732352

溫馨提示

  • 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. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論