《C语言程序课程设计商品进销存管理程序文件》由会员分享,可在线阅读,更多相关《C语言程序课程设计商品进销存管理程序文件(34页珍藏版)》请在金锄头文库上搜索。
1、一 题目及运行说明商品进销存管理程序 1、题目描述设计一个商品进销管理程序,该程序具有以下功能: 录入商品信息; 给定商品编号,修改该商品信息; 给定商品编号,删除该商品信息; 录入商品的进货和销售信息; 给定商品编号或商品名,查看该商品及库存信息; 统计功能:提供一些统计各类信息的功能。2、题目要求 按照分析、设计、编码、调试和测试过程完成应用程序; 学习并使用流程图等工具,并在撰写报告中使用; 程序的各项功能在程序运行时,以菜单形式选择并执行; 要求用户输入数据时,要给出清晰、明确的提示,包括:输入数据的内容、格式及其结束方式等 所有的信息存储在一个文件或多个中,并实现文件读写操作。 程序
2、中用链表存放商品及进销存信息并实现增删减功能。3、提示 提醒事件信息可以设计一个结构体类型 自己构思并增加的除规定功能之外的新功能,酌情加分。(1) 程序中主要变量Struct goods *head 结构体指针Int n,k struct goodsint number;char name20;int shumu;float jiage;struct goods *next;int n,k;struct goods *head;等一些变量。(2) 数据输入的形式和输入值的范围字符不超过20位整型变量输入大于0浮点型 变量也大于0商品编号为四位整数(3) 数据输入的形式按程序运行的提示操作(4
3、) 程序所能达到的功能及出错处理该程序具有以下功能: 录入商品信息; 给定商品编号,修改该商品信息; 给定商品编号,删除该商品信息; 录入商品的进货和销售信息; 给定商品编号或商品名,查看该商品及库存信息; 统计功能:提供一些统计各类信息的功能。二 程序设计思路根据要求首先设计一个结构体类型,设计好界面,设计好主函数。程序各功能通过调用子函数来实现用switch来实现菜单的选择一切数据信息通通存在文件中,并实现文件读写操作。设计子函数来实现查询,保存,读取数据,删除等操作。总体设计商品管理系统数据录入数据修改删除商品销售查找进货图1 系统功能模块图详细设计1. 主函数主函数设计要求简洁,只提供
4、部分提示语和函数的调用程序显示一系列功能选项输入k,判断k是否是06?根据k的值调用各功能模块函数结束开始k图2. 主函数流程图具体设计如下:结构体设计struct goodsint number;char name20;int shumu;float jiage;struct goods *next;主函数设计void main void jieman; void luru; struct goods *shuju; void shanchu; void jinghuo; void xiaoshu; void xiugai; void chaxun; struct goods *head=N
5、ULL; int k=0; system; jieman; printf; scanf;getchar; while head=shuju; switch case 1:luru;break; case 2:xiugai;break; case 3:chaxun;break; case 4:xiaoshu;break; case 5:jinghuo;break; case 6:shanchu;break; case 0:exit; default:printf; jieman; printf; scanf; 界面设计void jieman printf; printf; printf; pri
6、ntf; printf; printf; printf; printf; printf; printf; printf;文件保存函数设计struct goods *baocun struct goods *shuju; struct goods *p=NULL; FILE *fp=NULL; char ch=0; getchar; printf是否保存到文件?:; ch=getchar; putchar; if fp=fopen; p=head; if& printf; exit; while fprintfnumber,p-name,p-shumu,p-jiage; p=p-next; pr
7、intf; fclose; return; else if printf; head=shuju; return; else printfsorry,please try again:; ch=getchar; putchar; return;数据读取函数设计struct goods *shuju int n=0; FILE *fp; struct goods *head=NULL,*p1,*p2; fp=fopen; if printf; exit; else p1=p2=malloc; fscanfnumber,p1-name,&p1-shumu,&p1-jiage; while!feof
8、 n+; ifhead=p1; else p2-next=p1; p2=p1; p1=malloc; fscanfnumber,p1-name,&p1-shumu,&p1-jiage; p2-next=NULL; fclose; return; 录入函数设计void lurustruct goods *shuju;struct goods *baocun;struct goods *p1,*p2,*p3;head=shuju;p1=head;p2=malloc;printf;scanfnumber;printf;scanfname;printf;scanfshumu;printf;scanfj
9、iage;ifp1=p2;p2-next=NULL;baocun;return;whilep3=p1;p1=p1-next;p3-next=p2;p2-next=NULL;baocun;进货函数设计void jinghuostruct goods *baocun; int c; int p; struct goods *p1,*p2; system; printf; scanf; p1=head; whilenumber&p1-next!=NULL p2=p1; p1=p1-next; ifnumber printf; printfnumber,p1-name,p1-shumu,p1-jiage; printf; scanf; p1-shumu=p1-shumu+c; printfshumu; baocun;删除函数设计void shanchus