ImageVerifierCode 换一换
格式:DOCX , 页数:35 ,大小:339.39KB ,
资源ID:12591557      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/12591557.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(C语言程序课程设计商品进销存管理程序.docx)为本站会员(b****0)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

C语言程序课程设计商品进销存管理程序.docx

1、C语言程序课程设计商品进销存管理程序Prepared on 21 November 2021C语言程序课程设计商品进销存管理程序 一 题目及运行说明 商品进销存管理程序 1、题目描述设计一个商品进销管理程序,该程序具有以下功能:(1) 录入商品信息;(2) 给定商品编号,修改该商品信息;(3) 给定商品编号,删除该商品信息;(4) 录入商品的进货和销售信息;(5) 给定商品编号或商品名,查看该商品及库存信息;(6) 统计功能:提供一些统计各类信息的功能。2、题目要求(1) 按照分析、设计、编码、调试和测试过程完成应用程序;(2) 学习并使用流程图等工具,并在撰写报告中使用;(3) 程序的各项功

2、能在程序运行时,以菜单形式选择并执行;(4) 要求用户输入数据时,要给出清晰、明确的提示,包括:输入数据的内容、格式及其结束方式等(5) 所有的信息存储在一个文件或多个中,并实现文件读写操作。(6) 程序中用链表存放商品及进销存信息并实现增删减功能。3、提示(1) 提醒事件信息可以设计一个结构体类型(2) 自己构思并增加的除规定功能之外的新功能,酌情加分。(1)程序中主要变量Struct goods *head 结构体指针Int n,k struct goodsint number;char name20;int shumu;float jiage;struct goods *next;int

3、 n,k;struct goods *head;等一些变量。(2)数据输入的形式和输入值的范围字符不超过20位整型变量输入大于0浮点型 变量也大于0商品编号为四位整数(3)数据输入的形式按程序运行的提示操作(4)程序所能达到的功能及出错处理该程序具有以下功能:(1) 录入商品信息;(2) 给定商品编号,修改该商品信息;(3) 给定商品编号,删除该商品信息;(4) 录入商品的进货和销售信息;(5) 给定商品编号或商品名,查看该商品及库存信息;(6) 统计功能:提供一些统计各类信息的功能。二 程序设计思路根据要求首先设计一个结构体类型,设计好界面,设计好主函数。程序各功能通过调用子函数来实现用sw

4、itch来实现菜单的选择一切数据信息通通存在文件中,并实现文件读写操作。设计子函数来实现查询,保存,读取数据,删除等操作。 【总体设计】图1 系统功能模块图 【详细设计】1.主函数主函数设计要求简洁,只提供部分提示语和函数的调用【程序】 图2. 主函数流程图具体设计如下:结构体设计struct goodsint number;char name20;int shumu;float jiage;struct goods *next;主函数设计void main() void jieman(); void luru(); struct goods *shuju(); void shanchu(st

5、ruct goods *head); void jinghuo(struct goods *head); void xiaoshu(struct goods *head); void xiugai(struct goods *head); void chaxun(struct goods *head); struct goods *head=NULL; int k=0; system(cls); jieman(); printf(请选择你要的功能键:); scanf(%d,&k);getchar(); while(k!=0) head=shuju(); switch(k) case 1:lur

6、u();break; case 2:xiugai(head);break; case 3:chaxun(head);break; case 4:xiaoshu(head);break; case 5:jinghuo(head);break; case 6:shanchu(head);break; case 0:exit(0); default:printf(please try again!n); jieman(); printf(请选择你要的功能键:); scanf(%d,&k); 界面设计void jieman() printf(*n); printf(欢迎进入商品管理系统n); prin

7、tf(*1 *录入信息*n); printf(*2 *修改信息*n); printf(*3 *查询信息*n); printf(*4 *销售信息*n); printf(*5 *进货信息*n); printf(*6 *删除信息*n); printf(*0 *退出系统*n); printf(欢迎进入商品管理系统n); printf(*n);文件保存函数设计struct goods *baocun(struct goods *head) struct goods *shuju(); struct goods *p=NULL; FILE *fp=NULL; char ch=0; getchar(); p

8、rintf(是否保存到文件(y/n):); ch=getchar(); putchar(10); if(ch=y|ch=Y) fp=fopen(,wb); p=head; if(fp=NULL)&(p=NULL) printf(读取数据失败!); exit(0); while(p!=NULL) fprintf(fp,%dn%sn%dn%ft,p-number,p-name,p-shumu,p-jiage); p=p-next; printf(保存成功!n); fclose(fp); return(head); else if(ch=n|ch=N) printf(信息未保存到文件!n); hea

9、d=shuju(); return(head); else printf(sorry,please try again(y/n):); ch=getchar(); putchar(10); return(head);数据读取函数设计struct goods *shuju() int n=0; FILE *fp; struct goods *head=NULL,*p1,*p2; fp=fopen(,rb); if(fp=NULL) printf(nsorry,读取数据失败!n); exit(0); else p1=p2=(struct goods *)malloc(LEN); fscanf(fp

10、,%d%s%d%f,&p1-number,p1-name,&p1-shumu,&p1-jiage); while(!feof(fp) n+; if(n=1)head=p1; else p2-next=p1; p2=p1; p1=(struct goods *)malloc(LEN); fscanf(fp,%d%s%d%f,&p1-number,p1-name,&p1-shumu,&p1-jiage); p2-next=NULL; fclose(fp); return(head); 录入函数设计void luru()struct goods *shuju();struct goods *baoc

11、un(struct goods *head);struct goods *p1,*p2,*p3;head=shuju();p1=head;p2=(struct goods *)malloc(LEN);printf(请输入四位编号:);scanf(%d,&p2-number);printf(请输入商品名:);scanf(%s,p2-name);printf(请输入商品数量:);scanf(%d,&p2-shumu);printf(请输入商品价格:);scanf(%f,&p2-jiage);if(p1=NULL)p1=p2;p2-next=NULL;baocun(p2);return;while(

12、p1!=NULL)p3=p1;p1=p1-next;p3-next=p2;p2-next=NULL;baocun(head);进货函数设计void jinghuo(struct goods *head)struct goods *baocun(struct goods *head); int c; int p; struct goods *p1,*p2; system(cls); printf(请输入四位编号:); scanf(%d,&p); p1=head; while(p!=p1-number&p1-next!=NULL) p2=p1; p1=p1-next; if(p=p1-number

13、) printf(n 商品编号 t 商品名 t 数量 t 价格 n); printf(%dtt%stt%dtt%fn,p1-number,p1-name,p1-shumu,p1-jiage); printf(请输入该商品经货个数:); scanf(%d,&c); p1-shumu=p1-shumu+c; printf(该商品经货个数:%dn,p1-shumu); baocun(head);删除函数设计void shanchu(struct goods *head)struct goods *p1,*p2;struct goods *baocun(struct goods *head);int

14、p;system(cls);printf(请输入四位编号:);scanf(%d,&p);p1=head;while(p!=p1-number&p1-next!=NULL)p2=p1;p1=p1-next;if(p=p1-number)printf(n商品编号 t商品名 t 数量 t 价格 n);printf( %dtt%stt%dtt%.2fn,p1-number,p1-name,p1-shumu,p1-jiage);if(p1=head) head=p1-next;else p2-next=p1-next;n=n-1; printf(删除成功!n); baocun(head); 查询函数设计

15、void chaxun(struct goods *head) int a,c,i=0; struct goods *p1,*p2; char t20; printf( 1*商品编号查询n); printf( 2*商品名字查询n); printf(请选择你需要的功能键n); scanf(%d,&a); getchar(); if(a=1) printf(请输入四位编号:); scanf(%d,&c);getchar(); while(c!=0&i=0) p1=head; while(c!=p1-number&p1-next!=NULL) p2=p1;p1=p1-next; if(c=p1-nu

16、mber) printf(n 商品编号 t 名字 t 数目 t 价格:n); printf( %dt %st %dt %.2fn,p1-number,p1-name,p1-shumu,p1-jiage);i=1; else printf(系统中无该商品记录!press enter return!n);getchar();system(cls);return; if(a=2&i=0) system(cls);printf(请输入商品名字:); scanf(%s,&t);getchar(); while(strcmp(t,0)!=0&i=0) p1=head; if(strcmp(t,p1-nam

17、e)!=0&p1-next!=NULL) p2=p1;p1=p1-next; if(strcmp(t,p1-name)=0) printf(n 商品编号 t 名字 t 数目 t 价格:n); printf( %dt %st %dt %fn,p1-number,p1-name,p1-shumu,p1-jiage);i=1;else printf(系统中无该商品记录!press enter return!n);getchar();system(cls);return; 修改函数设计void xiugai(struct goods *head)struct goods *baocun(struct

18、goods *head); int p,i=0; struct goods *p1,*p2; system(cls); printf(请输入四位编号:); scanf(%d,&p); getchar(); if(p!=0) p1=head; while(p!=p1-number&p1-next!=NULL) p2=p1; p1=p1-next; if(p=p1-number) printf(n 商品编号 t 名字 t 数目 t 价格:n); printf( %dt %st %dt %fn,p1-number,p1-name,p1-shumu,p1-jiage); printf(请输入要修改的新

19、商品编号 ); scanf(%d,&p1-number); i=1; if(i=1) printf(修改后新商品编号 名字 数目 价格:n); printf(%d %s %d %f,p1-number,p1-name,p1-shumu,p1-jiage); printf(修改成功!n); baocun(head); 销售函数设计void xiaoshu(struct goods *head)struct goods *baocun(struct goods *head); int c; int p; struct goods *p1,*p2; system(cls); printf(请输入四位

20、编号:); scanf(%d,&p); getchar(); p1=head; while(p!=p1-number&p1-next!=NULL) p2=p1; p1=p1-next; if(p=p1-number) printf(n 商品编号 t 商品名 t 数量 t 价格 n); printf(%dtt%stt%dtt%fn,p1-number,p1-name,p1-shumu,p1-jiage); printf(请输入该商品售货个数:); scanf(%d,&c); p1-shumu=p1-shumu-c; printf(该商品经货个数:%dn,p1-shumu); baocun(hea

21、d);三 程序清单#include#include#include#include#define LEN sizeof(struct goods)struct goods 结构体int number; 商品编号char name20; 商品名int shumu; 商品数目float jiage; 商品价格struct goods *next;int n,k; 全局变量struct goods *head; 全局变量void main() 主函数 void jieman(); 界面函数声明 void luru(); 录入函数声明 struct goods *shuju(); 数据读取函数声明 v

22、oid shanchu(struct goods *head); 删除函数声明 void jinghuo(struct goods *head); 进货函数声明 void xiaoshu(struct goods *head); 销售函数声明 void xiugai(struct goods *head); 修改函数声明 void chaxun(struct goods *head); 查询函数声明 struct goods *head=NULL; int k=0; system(cls); jieman(); printf(请选择你要的功能键:); scanf(%d,&k);getchar(

23、); while(k!=0) head=shuju(); switch(k) case 1:luru();break; case 2:xiugai(head);break; case 3:chaxun(head);break; case 4:xiaoshu(head);break; case 5:jinghuo(head);break; case 6:shanchu(head);break; case 0:exit(0); default:printf(please try again!n); jieman(); printf(请选择你要的功能键:); scanf(%d,&k); struct

24、 goods *baocun(struct goods *head) 保存函数 struct goods *shuju(); struct goods *p=NULL; FILE *fp=NULL; char ch=0; getchar(); printf(是否保存到文件(y/n):); 判断是否保存 ch=getchar(); putchar(10); if(ch=y|ch=Y) fp=fopen(,wb); p=head; if(fp=NULL)&(p=NULL) printf(读取数据失败!); exit(0); while(p!=NULL) fprintf(fp,%dn%sn%dn%f

25、t,p-number,p-name,p-shumu,p-jiage); p=p-next; printf(保存成功!n); fclose(fp); return(head); else if(ch=n|ch=N) printf(信息未保存到文件!n); head=shuju(); return(head); else printf(sorry,please try again(y/n):); ch=getchar(); putchar(10); return(head); void chaxun(struct goods *head) 查询函数 int a,c,i=0; struct good

26、s *p1,*p2; char t20; printf( 1*商品编号查询n); printf( 2*商品名字查询n); printf(请选择你需要的功能键n); scanf(%d,&a); getchar(); if(a=1) printf(请输入四位编号:); scanf(%d,&c);getchar(); while(c!=0&i=0) p1=head; while(c!=p1-number&p1-next!=NULL) 查找商品 p2=p1;p1=p1-next; if(c=p1-number) printf(n 商品编号 t 名字 t 数目 t 价格:n); printf( %dt %st %dt %.2fn,p1-number,p1-name,p1-shumu,p1-jiage);i=1; else printf(系统中无该商品记录!press enter return!n);getchar();system(cls

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1