




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
实训报告实训项目:宠物商店管理系统院别专业:信息管理学院班级学号:学生姓名:煜指导教师:实训成绩:实验日期:2018年6月8日制信息管理学院制实践教学中心实训目的:1掌握C语法,函数,界面程序设计,文件操作。2掌握C文件编程方法。实训内容及要求:用C语言设计基于文件的宠物商店管理系统。要求具有信息显示、录入、修改、查询和删除的界面并完成相关功能。三、实训方案:系统功能结构、主要界面与主要代码:1.功能结构如下:以下图仅供参考,以实际所做的系统功能为准!!!!!2.主要功能介绍:}/*添加宠物类型*/voidtjcwlx(){inttypeId; chartypeName[20]; typeId=getcurrenttypeindex(); if(typeId==-1) { printf("当前宠物类型的数量已达上限,无法再次添加!\n"); return; } printf("请输入新增宠物类型:"); scanf("%s",typeName); pettypes[typeId-1].typeId=typeId; strcpy(pettypes[typeId-1].name,typeName);pettypes[typeId-1].petstore=0;printf("新宠物类型%s,已经添加成功!\n",typeName);};/*修改宠物类型*/voidxgcwlx(){ inttypeId;chartypeName[20]; printf("请输入需要修改宠物类型编号:");scanf("%d",&typeId); if(istypeexistsbyId(typeId)==-1) { printf("当前系统不存在您输入的宠物类型编号!\n"); return; } else { printf("名称:%s\n",pettypes[typeId-1].name); } printf("请输入修改后的宠物名称:"); scanf("%s",typeName); strcpy(pettypes[typeId-1].name,typeName); printf("编号是%d的宠物类型名称已经改成%s!\n",typeId,typeName);};/*显示全部的宠物类型*/voidtjqbdcwlx(){ inti; printf("类型编号\t类型名称\n"); for(i=0;i<SIZE;i++) { if(pettypes[i].typeId==0) { break; } printf("%3d\t\t%s\n",pettypes[i].typeId,pettypes[i].name); }};/*添加宠物进货记录*/voidtjcwxsjl(){ inttransId; inttypeId; intpurchasenum; time_ttp; structtm*p; time(&tp); p=localtime(&tp); transId=getcurrenttransinfoindex(); if(transId==-1) { printf("宠物交易记录次数已经达到上限,无法再次进货!"); return; } printf("请输入本次进货的宠物类型编号:"); scanf("%d",&typeId); if(istypeexistsbyId(typeId)==-1) { printf("当前系统不存在您输入的宠物类型编号!\n"); return; } printf("请输入本次宠物进货的数量:"); scanf("%d",&purchasenum); if(purchasenum<1) { printf("进货数量不能小于1,操作失败!\n"); return; } time(&tp); p=gmtime(&tp); pettransinfos[transId-1].year=p->tm_year+1900; pettransinfos[transId-1].month=p->tm_mon+1; pettransinfos[transId-1].day=p->tm_mday;//strftime(pettransinfos[transId-1].data,sizeof(pettransinfos[transId-1].data),"%Y-%m-%d",localtime(&tp)); pettransinfos[transId-1].transId=transId; pettransinfos[transId-1].typeId=typeId; pettransinfos[transId-1].num=purchasenum; pettransinfos[transId-1].transtype=0; updatepetstore(typeId,purchasenum,1); printf("本次宠物进货完成记录!");};/*添加宠物销售记录*/voidxscwqbjyjl(){ inttransId; inttypeId; intpurchasenum; time_ttp; structtm*p; time(&tp); p=localtime(&tp); transId=getcurrenttransinfoindex(); if(transId==-1) { printf("宠物交易记录次数已经达到上限,无法再次销售!"); return; } printf("请输入本次销售的宠物类型编号:"); scanf("%d",&typeId); if(istypeexistsbyId(typeId)==-1) { printf("当前系统不存在您输入的宠物类型编号!\n"); return; } printf("请输入本次销售的宠物数量:"); scanf("%d",&purchasenum); if(purchasenum>pettypes[typeId-1].petstore) { printf("当前该类型宠物的库存数量不足,无法进行销售!\n"); return; } time(&tp); p=gmtime(&tp); pettransinfos[transId-1].year=p->tm_year+1900; pettransinfos[transId-1].month=p->tm_mon+1; pettransinfos[transId-1].day=p->tm_mday; //strftime(pettransinfos[transId-1].data,sizeof(pettransinfos[transId-1].data),"%Y-%m-%d",localtime(&tp)); pettransinfos[transId-1].transId=transId; pettransinfos[transId-1].typeId=typeId; pettransinfos[transId-1].num=purchasenum; pettransinfos[transId-1].transtype=1; updatepetstore(typeId,purchasenum,2); printf("本次宠物销售完成记录!");};/*显示宠物全部交易记录*/voidxscwjytjxx(){ inti; char*name; printf("宠物编号\t宠物名称\t交易数量\t交易日期\t交易类型\n"); for(i=0;i<SIZET;i++) { if(pettransinfos[i].transId==0) { break; } if(pettransinfos[i].transtype==0) { name="入库"; } elseif(pettransinfos[i].transtype==1) { name="售出"; } else { name="未知"; } printf("%3d\t\t%s\t\t%3d\t\t%d-%d-%d\t%s\n",pettransinfos[i].typeId,pettypes[pettransinfos[i].typeId-1].name,pettransinfos[i].num,pettransinfos[i].year,pettransinfos[i].month,pettransinfos[i].day,name); }};/*显示宠物交易统计信息*/voidxszgncd(){ constchar*split="-"; inti; char*name; intmonth; intj; intpurchasenum=0; intsalenum=0; printf("请输入需要查看的月份:"); scanf("%d",&month); printf("类型编号\t类型名称\t入库数量\t销售数量\t库存数\n"); for(i=0;i<SIZE;i++) { if(pettypes[i].typeId==0) { break; } for(j=0;j<SIZET;j++) { if(pettransinfos[j].transId==0) { break; } if(pettransinfos[j].month==month&&pettransinfos[j].typeId==pettypes[i].typeId) { if(pettransinfos[j].transtype==0) { purchasenum+=pettransinfos[j].num; } else { salenum+=pettransinfos[j].num; } } } printf("%3d\t\t%s\t\t%3d\t\t%3d\t\t%3d\n",pettypes[i].typeId,pettypes[i].name,purchasenum,salenum,purchasenum-salenum); }};intgetcurrenttypeindex(){ intindex=-1; inti; for(i=0;i<SIZE;i++) {if(pettypes[i].typeId==0) { index=i+1; break; } } returnindex;}intgetcurrenttransinfoindex(){ intindex=-1; inti; for(i=0;i<SIZET;i++) { if(pettransinfos[i].transId==0) { index=i+1; break; } } returnindex;}intistypeexistsbyId(inttypeId){ if(typeId<1||typeId>SIZE||pettypes[typeId-1].typeId==0) { return-1; } else { return1; }}intupdatepetstore(inttypeId,intnum,intrecordtype){ intcount; count=pettypes[typeId-1].petstore; if(recordtype==1) { count+=num; } else { count-=num; } if(count>=0) { pettypes[typeId-1].pets
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 羽毛球线行业市场发展及发展趋势与投资战略研究报告
- 2025年中国江苏省网红经济行业市场竞争格局及投资前景展望报告
- 西安小学补录计划
- 中国二翅豆项目投资可行性研究报告
- 优惠合同范本
- 光谱仪光度计项目风险分析和评估报告
- 2024-2030年中国丙型肝炎病毒核酸检测试剂盒行业发展监测及投资战略研究报告
- 鸡油菌加工项目申请报告
- 2025年甲基丙稀酰氧丙基三甲氧基硅烷项目可行性研究报告
- 燃煤锅炉改造技术项目可行性研究报告申请报告
- 初中语文九年级下册阅读理解50篇附答案解析
- 《陶瓷造型工艺》课程标准
- 火电厂各指标指标解析(最新版)
- 病毒性脑炎患者的护理查房ppt课件
- TPU材料项目可行性研究报告写作参考范文
- 第二编 债权总论
- 试用期考核合格证明表
- 常见八种疾病
- 胶粘剂基础知识及产品详解(课堂PPT)
- 铁路总公司近期处理的七起突出质量问题的通报
- 常用洪水预报模型介绍
评论
0/150
提交评论