数据结构:产品进销存管理系统的源代码(c语言或c++的)

设计内容: 针对某一种行业的库房的产品进销存情况进行管理。1、采用一定的存储结构对库房的货品及其数量进行分类管理;2、可以进行产品类的添加、产品的添加、产品数量的添加;3、能够查询库房每种产品的总量、进货日期、销出数量、销售时间等; 设计要求:(1) 符合课题要求,实现相应功能;(2) 要求界面友好美观,操作方便易行;(3) 注意程序的实用性、安全性;

&(p->salesquantity),&(p->salestime).year),&((p->salestime).month),&((p->salestime).day)); p->nextproduct=q->nextproduct;
q->nextproduct=p;
q=p
}
}
return ok;
}//ProductInsert
void ProQuantity_add(sqmountlink&L,char pkindname 1[],char pname 1[],int n)
{//添加顺序表挂接链表的某产品的总量,且需添加的产品总量为n
int i,k;
plinklist p;
for(i=0;i<L.length;i++)
{
if(strcmp(L.kindelem[i]).pkindname,pkindname 1)!=0)
continue;
else
break;
}
if(i<L.length)
{
for(p=L.kindelem[i].firstproduct;p!=NULL;p=p->nextproduct)
{
k=strcnp(p->pname.pname);
if(k==0)
{
p->totalquantity=p->totalquantity+n;
printf("查看添加后产品的各项输出:%s %d%d,%d %d %d,%d,%d\n",p-pname,p->totalquantity,(p->goodsdate).year,(p->goodsdate).month,(p->goods).day,
p->salequanlity,(p->salestime).year,(p->salestime).month,(p->salestime).day);
}
}
}
}//ProQuantity_add
void Visit(sqmountlink&L,char pkindname3[],char pname3[])
{//在顺序表挂接链表L中,查询属于某产品类的某产品的各项信息
int i,k;
plinklist p;
for(i=0;i<L.length;i++)
{
if(strcmp((L.kindelem[i]),pkindname.pkindname3)!=0)
continue
else
break;
}
if(i<L.length)
{
for(p=L.kindelem[i].firstprodicy;p!=NULL;p=p->nextproducy)
{
k=strcmp(p->pname.pname3);
if(k==0)
break;
}
if(k!=0)
printf("此产品不存在:\n")
else
{
printf("输出带查询产品的各项信息:\n");
printf("%s %s %d %d,%d,%d %d %d,%d,%d\n",(L.kindelem[i]).pkindname,p->pname,p->totalquantity,(p->goodsdate).year,(p->goodsdate).month,(p->goodsdate).day,
p->salequantity,(p->salestime).year,(p->salestime).month,(p->salestime).day);
}
}
}//Visit
void DisplayList(sqmountlink&L)
{//显示各产品所属产品类,产品名称、产品总量,进货日期,销出数量,销售时间
int i;
plinklist p;
printf("产品类 产品 进货日期 销出数量 销售时间\n")
for(i=0;i<L.length;i++)
{
if(!(L.kindelem[i],firstproduct))
printf("%s\n",(L.kindelem[i]).pkindname);
for(p=L.kindelem[i].firstproduct;p;p=p->nextproduct)
printf("%s %s %d %d,%d,%d %d %d,%d,%d \n",(L.kindelem[i]).pkindname,p->pname,p->totalquantity,(p->goodsdate).year,(P->goodsdate).month,(p->goodsdate).day,p->salesquantity,(p->salestime).year,(p->salestime).month,(p->salestime).day);
}
}//DisplayList
void DestoryMountList(sqmountlink&L)
{//销毁已存在的顺序表挂接链表L
int i;
kindlnode *p;
for(i=L.length;i>=0;
{
p=&(L.kindelem[i]);
if(*p).firstproduct==NULL)
free(p);
else
{
while((*p).firstproduct;q->nextproduct;q=q->nextproduct);
free(q);
}
free(q);
}
}
}//DestroyMountList
void menu_operation()
{//操作菜单
printf("----输入所要执行操作:-------\n")
printf("----产品类的添加:1------\n");
printf("----产品的添加:2-----\n");
printf("----产品数量的添加:3-----\n");
printf("----查询每种产品所属产品类,产品总量,进货日期,销出数量,销售时间:4-----------\n")
printf("----释放L所占内存空间,退出程序:0-----\n");
}//menu_operation
/*--------------主程序-------------*/
void main(void)
{
int order,
int i,n;
char a[30];
char b[30];
sqmountlink L;
InitMountList(L);
printf("-----创建初始的产品类、产品顺序表挂接链表L-----\n");
CreatMuntList(L);
DisplayList(L);
printf("-----初始的产品类、产品顺序表挂接链表L创建完成-----\n");
menu_operation();
loop:
printf("输入命令:");
scanf("%d",&order);
switch(order)
{
case 1:
printf("需添加产品类的个数:");
scanf("%d",&i);
kindinsert(L,i);
printf("输出修改后的产品库存管理表:\n");
DisplayList(L);
goto loop;
case 2:
printf("需添加产品所属产品类的名称:")
scanf("%s",&a);
printf("需向此产品类添加产品的个数:");
scanf("%d",&i);
ProductInsert(L,a,i);
printf("输出修改后的产品库存管理表:\n");
DisplayList(L);
goto loop;
case 3:
printf("输入需添加数量的产品所属产品类的名称:");
scanf("%s",&a);
printf("输入需添加数量的产品的名称:");
scanf("%d",&n);
ProQuantity_add(L,a,b,n);
printf("输出修改后的产品库存管理表:\n");
DisplayList(L);
goto loop ;
case 4:
printf("输入待查询产品所属产品类的名称:");
scanf("%s",&b);
printf("输入待查询产品的名称:");
scanf(%s",&b);
Visit(L<a,b);
goto loop;
case ():
DestroyMountList(L);
exit(0);
}
}
温馨提示:答案为网友推荐,仅供参考
相似回答