C语言商品管理系统4_第1页
C语言商品管理系统4_第2页
C语言商品管理系统4_第3页
C语言商品管理系统4_第4页
C语言商品管理系统4_第5页
已阅读5页,还剩13页未读 继续免费阅读

下载本文档

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

文档简介

实训题目 超市商品管理系统实训题目 超市商品管理系统 本系统主要功能 1 新购物品入库新购物品入库 2 物品信息删除物品信息删除 3 物品信息修改物品信息修改 4 物品信息查询物品信息查询 5 物品信息浏览 物品信息浏览 数据结构数据结构 struct ima int id char name 20 char produce 30 int number float price 模块划分模块划分 Main 函数 主菜单 2 物品信 息删除 4 物品信息 查询 5 物品信息 浏览 3 物品信 息修改 1 新购物品入 库 原函数清单原函数清单 1 创建函数 void chushihua 2 增加物品函数 Tianjia 3 删除物品信息函数 Shanchu 4 修改物品信息函数 Xiugai 5 查询物品信息函数 Chazhao 6 浏览物品信息函数 Liulan 7 系统颜色设置函数 yanseshezhi 8 应用程序退出函数 Jieshu 开发工具和编程语言 开发工具和编程语言 编程语言 C 语言 开发工具 microsoft visual C 6 0 详细设计详细设计 1 结构体变量的定义 struct ima int id char name 20 char produce 30 int number float price 3 文件的初始化 void chushihua FILE fp struct ima i 1 123 1234 1200 2 5 fp fopen ima dat w if fp NULL printf t t t 系统错误 请重试 exit 0 fwrite fclose fp 4 欢迎菜单 主函数 void main char a 20 b 123 int i 0 printf 请输入密码 按回车结束 n while a i getch 13 printf i a i 0 if strcmp a b 0 printf n密码正确 n else printf n密码错误 n return printf n n printf txxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx n printf tx x n printf tx x n printf tx 欢迎使用 x n printf tx x n printf tx x n printf tx 超市商品管理系统 x n printf tx 按任意键继续 x n printf tx x n printf tx x n printf tx x n printf tx x n printf tx x n printf tx 3 n printf txxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx getch system cls menu initialization menu 密码加密密码加密 char a 20 b 123 int i 0 printf 请输入密码 按回车结束 n while a i getch 13 printf i a i 0 if strcmp a b 0 printf n密码正确 n else printf n密码错误 n return 调试分析调试分析 在密码加密部分花费了较多心思 最后终于决定用 if 语句来进行最后判断比较合适 调试结果调试结果 1 密码验证部分 2 欢迎界面 3 主菜单页面 4 物品信息浏览及新物品入库 心得总结心得总结 虽然只上了半个学期的 C 语言课程 但是本来对电脑就有几分兴趣的我对 C 语言也产生了 极大的兴趣 但是真正要写起程序来就遇到了很大的困难 首先不知道该如何下手 不知道自 己做的这个程序要实现什么样的功能 最后在到网上查询了许多相关资料后开始入手 这个程 序说实话属于我自己的东西比较少 但是都是我一字一句读懂别人程序后写下来的 最后 对 于网上的源程序是没有开头的密码验证的 这个是属于我自己编写的东西 也是花费了不少心 思 源程序源程序 include stdafx h include include include include struct ima int id char name 20 char produce 30 int number float price void Append void Selldelete void Amend void Findin void Browse void colorsetting void Endprogram void initialization FILE fp struct ima i 1 123 1234 1200 2 5 fp fopen ima dat恶 w if fp NULL printf t t t系统错误 请重试 exit 0 fwrite fclose fp void menu int choice printf n 超市库存管理系统 n printf n t1 新购物品入库 n printf n t2 物品信息删除 n printf n t3 物品信息修改 n printf n t4 物品信息查询 n printf n t5 物品信息浏览 n printf n t6 应用程序退出 n printf n t请输入您要选择的菜单 scanf d switch choice case 1 Append break case 2 Selldelete break case 3 Amend break case 4 Findin break case 5 Browse break case 6 Endprogram break default printf n t t t t t输入无效 请您重新输入 getch system cls menu int validateID int id FILE fp struct ima i fp fopen ima date r if fp NULL printf t t t系统错误 请您重试 exit 0 fread while feof fp if i id id fclose fp return 1 break fread fclose fp return 0 void Append struct ima i char choice FILE fp fp fopen ima date ab if fp NULL printf t t t系统错误 请您重试 exit 0 labID printf n t请您输入要入库物品的信息 n printf t t t t 物品的编号 scanf d if validateID i id 1 printf t t t t此编号已被使用 请您重新输入 goto labID printf t t t t 物品的名称 scanf s i name printf t t t t 物品的生产地 scanf s i produce printf t t t t 物品的数量 scanf d printf t t t t 物品的单价 scanf f fwrite fclose fp printf t t t t t t 物品信息已入库成功 n printf n您想继续吗 y n scanf c if choice Y choice y Append else system cls menu void Selldelete struct ima i 1000 struct ima temp int delID char choice int index 0 int j 0 FILE fp fp fopen ima date r if fp NULL printf t t t系统错误 请您重试 exit 0 fread while feof fp i index temp index fread fclose fp printf n t请输入要删除的物品的编号 scanf d fopen f ima date w if fp NULL printf t t t系统错误 请您重试 exit 0 for j 0 j index j if i j id delID fwrite fclose fp printf t t t t t物品信息已清除 n printf n您想继续吗 y n scanf c if choice Y choice y Selldelete else system cls menu void Amend int index 0 int ID j char choice struct ima i 1000 structima temp FILE fp fp fopen ima date r if fp NULL printf t t t系统错误 请您重试 exit 0 fread while feof fp i index temp index fread fclose fp fp fopen ima date w if fp NULL printf t t t系统错误 请您重试 exit 0 printf n t请输入要修改的信息的物品的编号 scanf d for j 0 j index 1 j if i j id ID fwrite else printf t t物品名称修改为 scanf s i j name printf t t物品生产地修改为 scanf s i j produce printf t t物品数量修改为 scanf d printf t t物品单价修改为 scanf f fwrite fclose fp printf t t t t物品信息已修改 printf n您想继续吗 y n scanf c if choice Y choice y Amend else system cls menu void Findin FILE fp int findID char choice struct ima i fp fopen ima date r if fp NULL printf t t t系统错误 请你重试 exit 0 finID printf n t请输入要查询的物品的编号 scanf d fread while feof fp if i id findID printf n n t 物品信息 printf n t物品编号 30d n i id printf n t printf n t物品名称 30s n i name printf n t printf n t生产厂家 30s n i produce printf n t printf n t进口数量 30d n i number printf n t printf n t批发价格 30 3f n i price printf n t printf n您想继续吗 y n scanf c if choice Y choice y Findin else system cls menu fread fclose fp printf t t t t t输入的编号不存在 请您重新输入 goto finID void Browse struct ima i int index 0 char choice FILE fp fp fopen ima date r if fp NULL printf t t t系统错误 请你重试 exit 0 fread while feof fp index printf n n t 物品信息 d index printf n t物品编号 30d n i id printf n t printf n t物品名称 30s n i name printf n t printf n t生产厂家 30s n i produce printf n t printf n t进口数量 30d n i number printf n t printf n t批发价格 30 3f n i price printf n t getch fread fclose fp printf n您想继续吗 y n scanf c if choice Y choice y Browse else system cls menu void Endprogram char choice system cls printf n n n n n n n t t t您确定要退出系统吗 n n n t t t如果您想退出请按 y 其它键将 返回主菜单 scanf c if choice Y choice y system cls printf n n n n n n n n n n t t t t谢谢您的使用 printf n n n n n n

温馨提示

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

评论

0/150

提交评论