C语言版商品库存管理系统(11页).doc
《C语言版商品库存管理系统(11页).doc》由会员分享,可在线阅读,更多相关《C语言版商品库存管理系统(11页).doc(11页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。
1、-C语言版商品库存管理系统-第 11 页建议使用VS打开运行#pragma once#includetypedef struct information /商品信息 char number20; /编号 char sname20; /名称 float price; /价格 int count; /数量 char dath20; /生产日期 struct information *next;inf;void menu(inf *head); /显示主菜单 inf *create(); /创建链表 void Input(inf *head); /输入商品信息 void tianjia(inf *h
2、ead); /添加商品信息 void output(inf *head); /输出商品信息 void chaxun(inf *head); /查询商品信息void chaxun_number(inf *head); /按编号查询 void chaxun_sname(inf *head); /按名称查询 void xiugai(inf *head); /修改商品信息 void shanchu(inf *head); /删除商品信息 void write_file(inf *head); /保存商品信息到文件 void paixu(inf *head);inf *Read_file(); /读取文
3、件内商品信息 void freeh(inf *head); /退出程序 #define _CRT_SECURE_NO_WARNINGS#include #include #include #include #include #include #pragma comment(lib, WINMM.lib)#include标头.hvoid menu(inf *head) /显示菜单 PlaySound(TEXT(sounds背景.wav), NULL, SND_FILENAME | SND_ASYNC | SND_LOOP); system(color 3B); printf(tt*n); pri
4、ntf(tttt欢迎进入商品库存管理系统n); printf(tt*n); printf(n); printf(tt|=|n); printf(tt|_基本信息_|n); printf(tt| 1.商品信息录入 | 2.添加商品信息 |n); printf(tt| 3.查找商品信息 | 4.修改商品信息 |n); printf(tt| 5.删除商品信息 | 6.保存文件信息 |n); printf(tt| 7.读取文件信息 | 8.显示商品信息 |n); printf(tt| 9.按价格从高到低进行排序 |n); printf(tt|_0.释放链表。退出_|); printf(nttt请输入你
5、的选项(0-8):n); printf(n); printf(t请输入你的选择: n);inf *create() /创建链表 inf *p; p = (inf *)malloc(sizeof(struct information); if (p = NULL) printf(链表创建失败.n); exit(0); p-next = NULL; return (p);void Input(inf *head) /录入货物信息 inf *p; int i,n; printf(请输入:你想录入多少个商品信息: n ); scanf(%d, &n); for (i = 1; i number); p
6、rintf(名称:); scanf(%s, p-sname); printf(价格:); scanf(%f, &p-price); printf(数量:); scanf(%d, &p-count); printf(生产日期:); scanf(%s,p-dath); p-next = NULL; while (head-next != NULL) head = head-next; head-next = p;void tianjia( inf *head) /添加货物信息 inf *p; int i,n; printf(请输入:你想添加多少个商品信息: n); scanf(%d, &n); f
7、or (i = 1; i number); printf(名称:); scanf(%s, p-sname); printf(价格:); scanf(%f, &p-price); printf(数量:); scanf(%d, &p-count); printf(生产日期:); scanf(%s,p-dath); p-next = NULL; while (head-next != NULL) head = head-next; head-next = p;void output(inf *head) /输出货物信息 int n = 0; inf *p; p = head-next; if (p
8、= NULL) printf(链表为空,请先输入信息!n); return; while (p != NULL) n+; printf(商品信息:编号: %s,名称:%s,价格:%.2f 数量:%d 生产日期:%sn, p-number, p-sname, p-price, p-count,p-dath); p = p-next; printf(商品总数为:%d n, n);void chaxun(inf *head) /查询货物信息 函数 int a; printf(tt查询信息n); while (1) printf(t 1.按编号查询n); printf(t 2.按名称查询n); pri
9、ntf(请输入你的选择:n); scanf(%d, &a); if (a = 1) chaxun_number(head);/调用按编号查询的函数 break; if (a = 2) chaxun_sname(head);/调用按名称查询的函数 break; if (a != 1 & a != 2) printf(输入错误!n); break; getchar();void chaxun_number(inf *head) /按编号查询 char num20; inf *p; int i = -1; p = head; printf(请输入你要查询的商品的编号:); scanf(%s, num
10、); while (p-next != NULL) p = p-next; if (strcmp(p-number, num) = 0) i = 1; printf(已找到该商品信息n); printf(货物信息:编号:%s,名称:%s,价格:%.2f.数量:%d,生产日期:%sn, p-number, p-sname, p-price, p-count,p-dath); if (inext != NULL) p = p-next; if (strcmp(p-sname, a) = 0) i = 1; printf(已找到该商品信息n); printf(商品信息:编号:%s,名称:%s,价格:
11、%.2f.数量:%d,生产日期n, p-number, p-sname, p-price, p-count,p-dath); if (inext != NULL) p = p-next; if (strcmp(p-number, no) = 0) i = 1; printf(已找到该商品n请输入新的的编号,名称,价格,数量:生产日期:n); printf(编号:); scanf(%s, p-number); printf(名称:); scanf(%s, p-sname); printf(价格:); scanf(%f, &p-price); printf(数量:); scanf(%d, &p-c
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 语言版 商品 库存 管理 系统 11
限制150内