[精选]C语言销售管理知识课程设计实验报告

上传人:庄** 文档编号:173066624 上传时间:2021-03-11 格式:DOCX 页数:38 大小:5.26MB
返回 下载 相关 举报
[精选]C语言销售管理知识课程设计实验报告_第1页
第1页 / 共38页
[精选]C语言销售管理知识课程设计实验报告_第2页
第2页 / 共38页
[精选]C语言销售管理知识课程设计实验报告_第3页
第3页 / 共38页
[精选]C语言销售管理知识课程设计实验报告_第4页
第4页 / 共38页
[精选]C语言销售管理知识课程设计实验报告_第5页
第5页 / 共38页
点击查看更多>>
资源描述

《[精选]C语言销售管理知识课程设计实验报告》由会员分享,可在线阅读,更多相关《[精选]C语言销售管理知识课程设计实验报告(38页珍藏版)》请在金锄头文库上搜索。

1、C语言课程设计实验报告C语言课程设计实验报告一、 目的(本次课程设计所涉及并要求掌握的知识点。)用户与商品信息要采用文件存储,因而要提供文件的输入输出操作;实现用户的添加、修改、删除;商品信息的添加、修改、删除、查找等功能;实现商品浏览功能的实现,需要实现显示操作;另外还要提供键盘式选择菜单以实现功能选择。二、使用环境 (本次上机实践所使用的平台和相关软件。 )Microsoft Visual C+三、内容与设计思想 (1 设计思路 2 主要数据结构 3 主要代码结构 4 主要代码段分析 。 )1、设计思路服装销售系统管理员模块店长模块销售员模块商品模块用户添加用户删除用户修改商品添加商品删除

2、商品修改商品查找商品浏览商品出售2、主要数据结构/* 系统用户结构 */typedef struct SystemUser char userName20; /用户名,主键 char password20; /用户密码 int userType; /用户类型(1:管理员;2:店长;3:销售员) struct SystemUser *next; /指向下一个用户的指针 SystemUser;/* 服装商品信息 */typedef struct Products int productId; /商品编号,主键 char productName20; /商品名称 char productType20

3、; /商品型号 char productCompany20; /商品厂家 float productPrice; /商品价格 int productCount; /商品数量 char memo50; /商品附加信息 struct Products *next; /指向下一个商品的指针 Products;/* 销售记录信息结构 */typedef struct SellInfoRecord int saleId; /销售编号,主键 char userName20; /销售商品的用户名 int productId; /销售的商品编号 int sellCount; /销售数量 int year; /

4、销售商品年份 int month; /销售商品月份 int day; /销售商品日期 char memo50; /销售的附加信息 struct SellInfoRecord *next; /下一条销售记录 SellInfoRecord;3、主要代码结构(一)添加打开文件,从键盘输入要添加的信息,若添加的信息与文件里的信息重复,则调用系统暂停函数,返回界面;若添加的信息在文件里没有找到,则将添加的信息输入到文件,调用系统暂停函数,返回界面。(2) 查询打开文件,从键盘输入要查询的信息,若在文件里找到要查询的信息,则在界面输入信息,并调用系统暂停函数,返回界面;若没有找到查询的信息,调用系统暂停函

5、数,返回界面。(3) 删除打开文件,从键盘输入要删除的信息,若在文件里找到要删除的信息存在,则把文件里要删除的那条信息删除掉,并调用系统暂停函数,返回界面;若没有找到删除的信息,调用系统暂停函数,返回界面。(4) 修改打开文件,从键盘输入要修改的信息,若在文件里找到要修改的信息存在,则按照提示信息依次输入要修改的信息,写入文件,并调用系统暂停函数,返回界面;若没有找到修改的信息,调用系统暂停函数,返回界面。4、 主要代码段分析/* 对系统进行初始化,建立用户记录和商品记录 */void InitSystem() FILE *fp; SystemUser adminUser,bossUser,s

6、ellUser; /管理员,店长,销售员三个角色信息 Products products2; /初始化两件服装商品信息 SellInfoRecord sellInfo2; /初始化两条销售记录/初始化管理员用户名、密码与类型 strcpy(adminUser.userName,admin); strcpy(adminUser.password,admin); adminUser.userType = ADMIN_USER_TYPE; adminUser.next = NULL;/打开管理员用户信息文件Admin.txt,写入信息,并关闭文件fp = fopen(Admin.txt, w);fp

7、rintf(fp, %st%s, adminUser.userName, adminUser.password);fclose(fp);AddUser(&adminUser); AddUser(&bossUser); AddUser(&sellUser); /添加第一条商品信息 strcpy(products0.productName,精品男装); strcpy(products0.productType,m001); strcpy(products0.productCompany,精品服装制造厂); products0.productPrice = 23.5; products0.produ

8、ctCount = 100; strcpy(products0.memo,精品男装,您的第一选择);products0.next = NULL;/添加第二条商品信息 strcpy(products1.productName,时尚女装); strcpy(products1.productType,w002); strcpy(products1.productCompany,时尚服装制造厂); products1.productPrice = 25.5; products1.productCount = 150; strcpy(products1.memo,时尚女装,您的第一选择); produc

9、ts1.next = NULL; AddProduct(&products0); AddProduct(&products1);/添加第一条销售报表记录 sellInfo0.day = 16; strcpy(sellInfo0.memo,测试数据1); sellInfo0.month = 7; sellInfo0.next = NULL; sellInfo0.productId = 1; sellInfo0.sellCount = 8; strcpy(sellInfo0.userName,sell);sellInfo0.year = 2008;/添加第二条销售报表记录 sellInfo1.da

10、y = 17; strcpy(sellInfo1.memo,测试数据2); sellInfo1.month = 7; sellInfo1.next = NULL; sellInfo1.productId = 2; sellInfo1.sellCount = 5; strcpy(sellInfo1.userName,sell); sellInfo1.year = 2008; AddSellInfo(&sellInfo0); AddSellInfo(&sellInfo1);/添加商品信息void InputAndAddProduct() Products product; printf(亲爱的%s

11、朋友,你好,请依次输入新商品的信息:n,currentUser);/输入商品名称、型号、制作商、价格、数量、附加信息,并把从键盘输入的值赋值给结构体变量的商品名称型号、制作商、价格、数量、附加信息 printf(商品名称:);scanf(%s,product.productName);printf(商品型号:); scanf(%s,product.productType); printf(商品制造商:); scanf(%s,product.productCompany); printf(商品价格:); scanf(%f,&product.productPrice); printf(商品数量:)

12、; scanf(%d,&product.productCount); printf(商品附加信息:); scanf(%s,product.memo);product.next = NULL;/若成功信息添加到结构体变量product里则提示添加成功if(FUNCTION_SUCCESS = AddProduct(&product) printf(商品信息添加成功!n);system(pause);/修改商品信息void ModifyProduct() int productId; /待修改的商品编号 Products *tmpProduct; printf(亲爱的%s朋友,你好,你现在进入的商品信息修改功能:n,currentUser); printf(请输入要修改的商品编

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 商业/管理/HR > 其它文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号