?? chaxundayudingjiage.h
字號:
///////////////輸出價格高于某個值的所有商品按價格排序輸出 8
void chaxundayudingjiage(struct shangpin shangp[],int count)
{
struct shangpin sp[MAXLENTH];
struct shangpin sptemb;
int total=-1;
int i=0,j=0;
int price=0;
mylabel1:
printf("\n\t\t 請輸入最底價格:");
scanf("%d",&price);getchar();
if(price<0)
{
printf("\n\t\t 價格不能小于0!!");
goto mylabel1;
}
for(i=0;i<count;i++)
if(shangp[i].price>=price)
{
total=total+1;
sp[total]=shangp[i];
}
for(i=0;i<total;i++)
for(j=total;j>i;j--)
if(sp[j-1].price>sp[j].price)
{
sptemb=sp[j];
sp[j]=sp[j-1];
sp[j-1]=sptemb;
}
if(total<0)
{
system("cls");
printf("\n\n\n\n\n\n\n");
printf("\n\t\t 這個價格段沒有商品\n\n");
printf("\n\t\t 查詢完成,按任意鍵繼續其他操作...."); getchar();
}
else
{
system("cls");
printf("\n\t\t 商品信息如下:");
for(i=0;i<=total;i++)
{
printf("\n\t\t _________________________________");
printf("\n\t\t 商品編號:%d",sp[i].id);
printf("\n\t\t 商品名稱:%s",sp[i].spname);
printf("\n\t\t 商品價格:%.2f",sp[i].price);
printf("\n\t\t 商品庫存:%d",sp[i].kucun);
printf("\n\t\t _________________________________");
}
printf("\n\t\t 查詢完成,按任意鍵繼續其他操作....");
getchar();
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -