版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
题目是:
设计一个简单仓储管理系统,要求含有基础操作功效:插入(添加)、删除、查找、修改和统计。
业务介绍
1.采购人员将采购物资清单交和财务人员,其中包含部分必需数据.财务人员据此作帐,将数据记入,并开一张票据,交和采购人员实现物资入库.
2.当有物资卖出时,即物资出库,财务人员会查阅现在这类货物库存情况,如这类货物还有存量,且有不一样出价时,财务人员会依据情况,调出对应价货物.
因为市场行情时常波动,管理人员可能会据此对物资做出对应调价.
3.当货物出现问题,需要退给供货商,并把退还货物名,数量,金额,统计下来.
4.到一定时期时候,比如月底,年底,需要将多种物资出入库,库存金额整理出来,方便为管理人员提供详尽,可靠数据,为下一步制订目标方案提供依据.
2、1数据结构
用4个结构数组(或链表)来存放下述4类信息,每类信息每条统计用结构类型自定义:
1.商品信息:商品编号、商品名、型号/规格、数量、进货价、销售价
2.入库信息:入库编号、商品编号、入库商品名、入库数量、入库价格、总价
3.出库信息:出库编号、商品编号、出库商品名、出库数量、出库价格、总价
4.退货信息:退货编号、商品编号、退还货物名、退货数量、退货价格、总价
2、2
设计要求
5.
对以上每类信息建立数据结构
6.
对以上每类信息进行插入操作
7.
对以上每类信息进行删除操作
8.
对以上每类信息进行修改操作
9.
对以上每类信息进行查找操作(查找关键字用下划线标出)
10.
数据统计;
i.
统计入库商品总数及总价:
ii.
统计出库商品总数及总价:
iii.
统计仓库中现有商品总数及总价格:
#include
<stdio.h>
#include
<string.h>
struct
product
{
char
p_num[12];
char
name[12];
char
spec[12];
int
amount;
int
price;
int
s_price;
struct
product
*next;
};
struct
product
*head;
struct
in_product
{
char
num[12];
char
p_num[12];
char
name[12];
int
amount;
int
price;
int
t_price;
struct
in_product
*next;
};
struct
in_product
*ihead;
struct
out_product
{
char
num[12];
char
p_num[12];
char
name[12];
int
amount;
int
price;
int
t_price;
struct
out_product
*next;
};
struct
out_product
*ohead;
struct
quit_product
{
char
num[12];
char
p_num[12];
char
name[12];
int
amount;
int
price;
int
t_price;
struct
quit_product
*next;
};
struct
quit_product
*qhead;
int
init()
{
head=ihead=ohead=qhead=NULL;
printf("0:
Quit\n");
printf("1:
Enter
the
information
of
in
product\n");
printf("2:
Enter
the
information
of
out
product\n");
printf("3:
Enter
the
information
of
quit
product\n");
printf("4:
Total
the
information
of
product\n");
}
int
menu()
{
printf("1:insert
data\n");
printf("2:delete
data\n");
printf("3:modify
data\n");
printf("4:select
data\n");
printf("Other
to
quit\n");
}
int
menu2()
{
printf("0:
Quit\n");
printf("1:
Enter
the
information
of
in
product\n");
printf("2:
Enter
the
information
of
out
product\n");
printf("3:
Enter
the
information
of
quit
product\n");
printf("4:
Total
the
information
of
product\n");
}
int
insert_product()
{
struct
product
*
p1,*
p;
p1=(struct
product
*)malloc(sizeof(struct
product));
p=head;
if
(p==NULL)/*开始没有数据*/
{
printf("Enter
the
data
of
product\n");
printf("Include
the
spbh,name,style,num,price,sale_price
of
product\n");
scanf("%s%s%s%d%d%d",
&p1->p_num,&p1->name,&p1->spec,&p1->amount,&p1->price,&p1->s_price);head=p1;
head->next=NULL;
return
0;
}
while(p->next!=NULL)/*把指针移到链表末端,在链表末端插入数据*/
p=p->next;
p->next=p1;
printf("Enter
the
data\n");
scanf("%s%s%s%d%d%d",
&p1->num,&p1->p_num,&p1->name,&p1->amount,&p1->price,&p1->t_price);
p1->next=NULL;
}
int
in_insert()
{
struct
in_product
*
p1,*
p;
p1=(struct
in_product
*)malloc(sizeof(struct
in_product));
p=ihead;
if
(p==NULL)/*开始没有数据*/
{
printf("Enter
the
data
of
in
product\n");
printf("Include
the
rkbh,spbh,name,number,price,total_price\n");
scanf("%s%s%s%d%d%d",
&p1->num,&p1->p_num,&p1->name,&p1->amount,&p1->price,&p1->t_price);
ihead=p1;
ihead->next=NULL;
return
0;
}
while(p->next!=NULL)/*把指针移到链表末端,在链表末端插入数据*/
p=p->next;
p->next=p1;
printf("Enter
the
data\n");
scanf("%s%s%s%d%d%d",
&p1->num,&p1->p_num,&p1->name,&p1->amount,&p1->price,&p1->t_price);
p1->next=NULL;
}
int
in_modify()
{
char
m_num[12];
struct
in_product
*
p;
p=ihead;
printf("Enter
the
modify
num\n");
scanf("%s",&m_num);
if
(p==NULL)/*开始没有数据*/
{
printf("Sorry!
No
data
can
be
found\n");
return
0;
}
while(p!=NULL)
{
if
(strcmp(p->num,m_num)==0)
{
printf("Enter
the
new
data
without
num\n");
scanf("%s%s%d%d%d",
&p->p_num,&p->name,&p->amount,&p->price,&p->t_price);
printf("One
data
had
modified\n");
return
0;
}
p=p->next;
}
printf("Sorry!
No
num
has
found\n");
}
int
in_select()
{
char
s_num[12];
struct
in_product
*
p;
p=ihead;
printf("Enter
the
select
num\n");
scanf("%s",&s_num);
while(p!=NULL)
{
if
(strcmp(p->num,s_num)==0)
{
printf("The
data
you
want
is:\n");
printf("
%s
%s
%s
%d
%d
%d\n",
p->num,p->p_num,p->name,p->amount,p->price,p->t_price);
return
0;
}
p=p->next;
}
printf("Sorry!
No
num
has
found\n");
}
int
in_delete()
{
char
d_num[12];
struct
in_product
*
p1,*
p;
p=ihead;
printf("Enter
the
delete
num\n");
scanf("%s",&d_num);
if
(p==NULL)/*开始没有数据*/
{
printf("No
data
can
be
found\n");
return
0;
}
if
(strcmp(p->num,d_num)==0
&&
p->next==NULL)/*链表只有一个数据,且是要删除*/
{
ihead=NULL;
printf("One
data
has
been
deleted\n");
return
0;
}
if
(strcmp(p->num,d_num)==0
&&
p->next!=NULL)/*要删除数据在链表头上*/
{
ihead=ihead->next;
printf("One
data
has
been
deleted\n");
return
0;
}
while(p->next!=NULL)
{
p1=p->next;
if
(strcmp(p1->num,d_num)==0)
{
p->next=p1->next;
printf("One
data
has
been
deleted\n");
return
0;
}
p=p->next;
}
printf("Sorry!
No
num
has
found\n");
}
int
out_insert()
{
struct
out_product
*
p1,*
p;
p1=(struct
out_product
*)malloc(sizeof(struct
out_product));
p=ohead;
if
(p==NULL)/*开始没有数据*/
{
printf("Enter
the
data
of
out
product\n");
printf("Include
the
ckbh,spbh,name,number,price,total_price\n");
scanf("%s%s%s%d%d%d",
&p1->num,&p1->p_num,&p1->name,&p1->amount,&p1->price,&p1->t_price);
ohead=p1;
ohead->next=NULL;
return
0;
}
while(p->next!=NULL)/*把指针移到链表末端,在链表末端插入数据*/
p=p->next;
p->next=p1;
printf("Enter
the
data\n");
scanf("%s%s%s%d%d%d",
&p1->num,&p1->p_num,&p1->name,&p1->amount,&p1->price,&p1->t_price);p1->next=NULL;
}
int
out_modify()
{
char
m_num[12];
struct
out_product
*
p;
p=ohead;
printf("Enter
the
modify
num\n");
scanf("%s",&m_num);
if
(p==NULL)/*开始没有数据*/
{
printf("Sorry!
No
data
can
be
found\n");
return
0;
}
while(p!=NULL)
{
if
(strcmp(p->num,m_num)==0)
{
printf("Enter
the
new
data
without
num\n");
scanf("%s%s%d%d%d",
&p->p_num,&p->name,&p->amount,&p->price,&p->t_price);
printf("One
data
had
modified\n");
return
0;
}
p=p->next;
}
printf("Sorry!
No
num
has
found\n");
}
int
out_select()
{
char
s_num[12];
struct
out_product
*
p;
p=ohead;
printf("Enter
the
select
num\n");
scanf("%s",&s_num);
while(p!=NULL)
{
if
(strcmp(s_num,p->num)==0)
{
printf("The
data
you
want
is:\n");
printf("
%s
%s
%s
%d
%d
%d\n",
p->num,p->p_num,p->name,p->amount,p->price,p->t_price);
return
0;
}
p=p->next;
}
printf("Sorry!
No
num
has
found\n");
}
int
out_delete()
{
char
d_num[12];
struct
out_product
*
p1,*
p;
p=ohead;
printf("Enter
the
delete
num\n");
scanf("%s",&d_num);
if
(p==NULL)/*开始没有数据*/
{
printf("No
data
can
be
found\n");
return
0;
}
if
(strcmp(p->num,d_num)==0
&&
p->next==NULL)/*链表只有一个数据,且是要删除*/
{
ohead=NULL;
printf("One
data
has
been
deleted\n");
return
0;
}
if
(strcmp(p->num,d_num)==0
&&
p->next!=NULL)/*要删除数据在链表头上*/
{
ohead=ohead->next;
printf("One
data
has
been
deleted\n");
return
0;
}
while(p->next!=NULL)
{
p1=p->next;
if
(strcmp(p1->num,d_num)==0)
{
p->next=p1->next;
printf("One
data
has
been
deleted\n");
return
0;
}
p=p->next;
}
printf("Sorry!
No
num
has
found\n");
}
int
quit_insert()
{
struct
quit_product
*
p1,*
p;
p1=(struct
quit_product
*)malloc(sizeof(struct
quit_product));
p=qhead;
if
(p==NULL)/*开始没有数据*/
{
printf("Enter
the
data
of
quit
product\n");
printf("Include
the
thbh,spbh,name,number,price,total_price\n");
scanf("%s%s%s%d%d%d",
&p1->num,&p1->p_num,&p1->name,&p1->amount,&p1->price,&p1->t_price);
qhead=p1;
qhead->next=NULL;
return
0;
}
while(p->next!=NULL)/*把指针移到链表末端,在链表末端插入数据*/
p=p->next;
p->next=p1;
printf("Enter
the
data\n");
scanf("%s%s%s%d%d%d",
&p1->num,&p1->p_num,&p1->name,&p1->amount,&p1->price,&p1->t_price);
p1->next=NULL;
}
int
quit_modify()
{
char
m_num[12];
struct
quit_product
*
p;
p=qhead;
printf("Enter
the
modify
num\n");
scanf("%s",&m_num);
if
(p==NULL)/*开始没有数据*/
{
printf("Sorry!
No
data
can
be
found\n");
return
0;
}
while(p!=NULL)
{
if
(strcmp(p->num,m_num)==0)
{
printf("Enter
the
new
data
without
num\n");
scanf("%s%s%d%d%d",
&p->p_num,&p->name,&p->amount,&p->price,&p->t_price);
printf("One
data
had
modified\n");
return
0;
}
p=p->next;
}
printf("Sorry!
No
num
has
found\n");
}
int
quit_select()
{
char
s_num[12];
struct
quit_product
*
p;
p=qhead;
printf("Enter
the
select
num\n");
scanf("%s",&s_num);
while(p!=NULL)
{
if
(strcmp(s_num,p->num)==0)
{
printf("The
data
you
want
is:\n");
printf("
%s
%s
%s
%d
%d
%d\n",
p->num,p->p_num,p->name,p->amount,p->price,p->t_price);return
0;
}
p=p->next;
}
printf("Sorry!
No
num
has
found\n");
}
int
quit_delete()
{
char
d_num[12];
struct
quit_product
*
p1,*
p;
p=qhead;
printf("Enter
the
delete
num\n");
scanf("%s",&d_num);
if
(p==NULL)/*开始没有数据*/
{
printf("No
data
can
be
found\n");
return
0;
}
if
(strcmp(p->num,d_num)==0
&&
p->next==NULL)/*链表只有一个数据,且是要删除*/
{
qhead=NULL;
printf("One
data
has
been
deleted\n");
return
0;
}
if
(strcmp(p->num,d_num)==0
&&
p->next!=NULL)/*要删除数据在链表头上*/
{
qhead=qhead->next;
printf("One
data
has
been
deleted\n");
return
0;
}
while(p->next!=NULL)
{
p1=p->next;
if
(strcmp(p1->num,d_num)==0)
{
p->next=p1->next;
printf("One
data
has
been
deleted\n");
return
0;
}
p=p->next;
}
printf("Sorry!
No
num
has
found\n");
}
int
total()
{
int
in_num=0,in_price=0;
int
out_num=0,out_price=0;
int
num=0,price=0;
struct
in_product
*ip;
struct
out_product
*op;
struct
product
*p;
ip=ihead;
while(ip!=NULL)
{
in_num+=ip->amount;
in_price+=ip->t_price;
ip=ip->next;
}
op=ohead;
while(op!=NULL)
{
out_num+=op->amount;
out_price+=op->t_price;
op=op->next;
}
p=head;
while(p!=NULL)
{
num+=p->amount;
price+=p->s_price;
p=p->next;
}
printf("The
in
product's
total
number
and
total
price
is:\n");
printf("%d
%d\n",in_num,in_price);
printf("The
out
product's
total
number
and
total
price
is:\n");
printf("%d
%d\n",out_num,out_price);
printf("The
product's
total
number
and
total
price
is:\n");
printf("%d
%d\n",num,price);
}
int
in_case()
{
int
choice;
printf("The
information
of
in
product:\n");
while(1)
{
printf("Enter
th
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2024婚前房产约定协议
- 2024年浙教版六年级下册数学期末测试卷带答案(考试直接用)
- 2024司机安全责任协议书范本
- 2024年演出经纪人之演出经纪实务通关考试题库带答案(巩固)
- 2024年演出经纪人之演出经纪实务通关题库(真题汇编)
- 2024年演出经纪人之演出经纪实务题库综合试卷含答案(能力提升)
- 2024年演出经纪人之演出经纪实务高分通关题库含答案(能力提升)
- 2024年演出经纪人之演出经纪实务高分题库(网校专用)
- 2024年苏教版六年级下册数学期末测试卷含答案【综合卷】
- 2024年苏教版六年级下册数学期末测试卷附参考答案【突破训练】
- Unit6-Wheres-My-Recycling-Box市公开课一等奖省赛课微课金奖课件
- 2024年浙江省嘉兴重点中学中考物理押题卷含解析
- 幼儿园思政课主题教育方案
- 智能锁操作说明书
- 2024山东省科创集团有限公司管理储备人才校园招聘笔试参考题库含答案解析
- 回转窑检维修作业培训
- (正式版)SHT 3225-2024 石油化工安全仪表系统安全完整性等级设计规范
- 矿安益620道学习题
- 《文创产品包装设计》课件-4.1 任务一:地域文创产品包装设计
- 2023年北京西城初二(下)期末物理试卷及答案
- 严重精神障碍患者家属护理教育
评论
0/150
提交评论