「栈和队列商品货架管理」求一个 供货信息管理系统 用栈 数据结构课程设
在数据库中按时间降序排序,例如:从(表名称)中选择(字段名称)orderby(生产日期)desc C语言数据结构问题,商品货架管理 在货架中可以看到商
很多朋友都想知道求一个 供货信息管理系统 用栈 数据结构课程设计 商店货架以栈的形式摆放商品,生产日期越近的越靠近栈底,,下面就让小编来给大家分享一下。
在数据库中按时间降序排序,例如:从(表名称)中选择(字段名称)orderby(生产日期)desc
C语言数据结构问题,商品货架管理
在货架中可以看到商品货架,其顶部的生产日期是最早的,而底部的生产日期是最新的。装载货物时,需要倒置货架以确保生产日期相对较近的产品处于较低的位置。
#include
#include
#definesize4
structdata / *定义产品信息* / charname [6]; / *产品名称* /
longintdate; / *产品生产日期* / typedefstruct / *定义序列堆栈* / structdatasp [size];
inttop;
} seqstack;
intpush1(seqstack * s1)inti = 0;
(s1-> top = 0; s1-> top top ++)printf(“请输入%d项的产品名称:”,s1-> top + 1);
scanf( “%s”,s1-> sp [s1-> top] .name);
printf(“请输入生产日期:”);
scanf(“%d”,&s1-> sp [s1 -> top] .date);
printf(“ \ n”); return(-s1-> top); intcmp(seqstack * s1、seqstack * s2、intTOP)structdatanew;
s1-> top = TOP;
s2-> top = -1;
printf(“请输入新产品名称:”);
数据结构课程设计基于栈的商品货架管理的设计
scanf(“%s”,new.name);
printf( “请输入生产日期:”);
scanf(“%d”,&new.date);
同时(s1-> top!=-1 && new.date-s1-> sp [s1-> top] .date> 0)
/ *比较新旧产品的生产日期* / s2-> top ++;
strcpy(s2-> sp [s2-> top] .name,s1-> sp [s1 -> top] .name);
s2-> sp [s2-> top] .date = s1-> sp [s1-> t op] .date;
s1-> top-; s1-> top ++; / *新商品已插入货架* /
strcpy(s1-> sp [s1-> top] .name,新。名称);
s1-> sp [s1-> top] .date = new.date;
for(; s2-> top> -1; s2-> top-)s1-> top ++;
strcpy(s1-> sp [s1-> top] .name,s2-> sp [s2-> top] .name);
s1-> sp [s1-> top] .date = s2-> sp [s2-> top] .date; return(s1-> top); voidpop(seqstack * s1、intTOP)/ *在插入新产品之后输出货架上的产品订单* / printf(“产品更新后的货架是:\ n“);
printf(”产品名称生产日期:\ n“);
for(s1-> top = TOP; s1-> top> = 0; s1 -> top-)printf(“%s”,s1-> sp [s1-> top] .name);
printf(“%d \ n”,s1-> sp [s1-> top]。 date); printf(“ over”); voidmain()intTOP = 0;
seqstackA,B;
TOP = push1(&A);
TOP = cmp(&A,&B,TOP);
pop(&A,TOP);
以上就是小编与你分享的求一个 供货信息管理系统 用栈 数据结构课程设计 商店货架以栈的形式摆放商品,生产日期越近的越靠近栈底,,希望能对你有所帮助。想要了解更多有关货架的新闻和资料,请持续关注本站。
本文来自投稿,不代表http://www.xswww.net/15427.html立场,如若转载,请注明出处。