📄 chaxunduankucun.h
字号:
///////////////查询给定数值段中库存最高的商品信息 7
void chaxunduankucun(struct shangpin shangp[],int count)
{
struct shangpin MAXsp;
int i=0;
int low,high;
int zhaodao=-1;
mylabel1:
mylabel2:
printf("\n\t\t 请输入最小库存:");
scanf("%d",&low);getchar();
if(low<0)
{
printf("\n\t\t 最小库存不能小于0!!");
goto mylabel2;
}
mylabel3:
printf("\n\t\t 请输入最大库存:");
scanf("%d",&high);getchar();
if(high<0)
{
printf("\n\t\t 最大库存不能小于0!!");
goto mylabel3;
}
if(low>high)
{
printf("\n\t\t 最小库存不能大于最大库存!!");
goto mylabel1;
}
for(i=0;i<count;i++)
{
if(shangp[i].kucun>=low && shangp[i].kucun<=high)
{
MAXsp=shangp[i];
zhaodao=1;
if(MAXsp.kucun<shangp[i].kucun)
{
MAXsp=shangp[i];
}
}
}
if(zhaodao==-1)
{
printf("\n\t\t 给定数值段中的库存不在所有商品的库存内\n");
}
else
{
printf("\n\t\t 给定数值段中库存最高的商品信息如下:");
printf("\n\t\t _________________________________");
printf("\n\t\t 商品编号:%d",MAXsp.id);
printf("\n\t\t 商品名称:%s",MAXsp.spname);
printf("\n\t\t 商品价格:%.2f",MAXsp.price);
printf("\n\t\t 商品库存:%d",MAXsp.kucun);
printf("\n\t\t _________________________________");
}
printf("\n\t\t 查询完成,按任意键继续其他操作....");
getchar();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -