?? 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 + -