商场收银系统(c语言设计)_第1页
商场收银系统(c语言设计)_第2页
商场收银系统(c语言设计)_第3页
商场收银系统(c语言设计)_第4页
商场收银系统(c语言设计)_第5页
已阅读5页,还剩14页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、课 程 设 计 课程名称 C语言程序设计课程设计A题目名称 商场收银系统 目 录1 系统分析11.1 课程设计内容11.2 系统功能需求分析11.3 数据结构设计12 系统设计22.1 总体设计22.2 详细设计22.2.1 界面设计22.2.2 各功能模块的设计33 系统编码设计43.1 main函数44 系统运行55 总结6171 系统分析1.1 课程设计内容建立一商品信息文件,商品信息包括商品编号、商品名、商品类别、商品数量、商品价格等。建立一商场收银系统,功能包括:1. 系统登录:运行系统时,收银员应输入姓名(或编号)及密码,验证后方可使用系统。2. 收银操作:收银员逐条输入商品编号及

2、数量,系统自动计算金额,输入完毕后显示应付款,当输入实收额后,计算出找赎值。3. 交易完成后按一定格式显示回单(格式参照一般超市中的打印小票)。 4. 保存所显示的回单。5. 自动按销售情况更新商品信息文件中的数据。6. 查询收银员销售信息。7. 浏览库存商品信息。1.2 系统功能需求分析本系统应具有以下功能:1、文件操作功能进行商品信息管理,以文本的形式保存商品最新信息2、数据输入功能个人登录,消费商品基本资料的输入,销售信息输入等3、数据添加、修改、删除功能商品数据更新,个人入库信息修改更新4、计算功能基本计算功能,销售额处理5、查询功能资料库信息查询7、数据显示功能保障客户知情权,对系统

3、输入输出信息的显示2 系统设计2.1 总体设计按系统分析的功能要求将系统划分为以下几个主要功能模块:1、 建立新文本库信息模块2、 销售系统模块3、 商品销售信息回单模块4、 商品库更新模块5、 销售回单保存模块2.2 详细设计2.2.1 界面设计1、菜单设计主菜单:子菜单:2、输入界面的设计3、信息显示界面的设计2.2.2 各功能模块的设计根据划分的功能模块,定义以下函数实现各功能:(这部分应介绍各函数的原型,各功能模块实现所用的算法,可用流程图描述)1、主函数main()界面显示密码登录系统主菜单界面销售界面2、charge函数、receipt_m函数商品信息录入商品销售额输出等商品销售信

4、息显示3、input_s函数商品信息录入更新商品基本信息录入最新商品信息保存更新信息库内容4、disp函数最新消费信息建立保存显示信息库内容3 系统编码设计(这部分将代码列出,注意,每个函数开始处要介绍函数的功能,重要的代码应有注释,代码格式按锯齿式编排)3.1 main函数void main()/*主函数:密码登陆与主页面显示使用*/int key,j; int x,i; void openf(); void newf();loop1:clrscr(); gotoxy(10,4); for(i=0;i<20;i+) printf("# "); gotoxy(10,1

5、6); 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"); gotoxy(16,1

6、0);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函数/*主页面显示代码,子函数选择界面*/gotoxy(16,8); p

7、rintf("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")

8、; 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<

9、20;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:e

10、xit(); while(1);3.3 newf函数/*新建库信息函数,建立新文档存储更新商品信息*/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(1

11、6,10); printf("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()

12、;/*system("cls");*/ 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"); f

13、p3=fopen("d.txt","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函数/*销售信息管理系统*/charge()int i,j,f;int No; float sum=0;float change,receive; clrscr(); gotoxy(10,5); for

14、(i=0;i<20;i+) printf("* "); 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,&goo

15、dsi.amount); do printf("ntNo.: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,goo

16、dsN,goodsNo.price,j); fclose(fp2); 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=re

17、ceive-sum;printf("ntchange:t%5.2f",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,,g

18、oodsi.price,goodsi.amount); fclose(fp); fp1=fopen("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函数/*客户回单信息*/receipt_m()int i,No,

19、j; float change,receive,sum; clrscr();gotoxy(10,5); for(i=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%f

20、t%f",&goodsNo.num,&j,&sum,&receive,&change); for(i=0;i<n1;i+) printf("ntNo:t%dntamount:t%dntsum:t%5.2fntreceive:%5.2fntchange:t%5.2fn",goodsNo.num,j,sum,receive,change); fclose(fp3); else printf("errorn");gotoxy(10,20); for(i=0;i<20;i+) printf("

21、;* "); gotoxy(16,22);printf("Press any key to exit");getch(); 3.6 input函数/*库存信息更新*/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"); fscan

22、f(fp1,"%d%d",&n,&n1); fp=fopen("a.txt","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(&qu

23、ot;ncontinue?(y/n)");f=getch(); if(f='n') break; for(i=0;i<=j;i+) 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函数/*显示最近销售信息*/sell_m() int i,j,No; clrscr();g

24、otoxy(10,5); for(i=0;i<20;i+) printf("* ");printf("ntsalesperson_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+) fsca

25、nf(fp2,"%st%dt%st%dt%dn",salesperson_num,&goodsNo.num,goodsN,&goodsNo.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); else printf("errorn");gotoxy(10,20); for(i=0;i<20

26、;i+) printf("* "); gotoxy(16,22);printf("Press any key to exit");getch();3.8 display函数/*显示最近销售的库存信息*/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,"%d",&n); if( fp=fopen(xname,&quo

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论