⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chaxundayudingjiage.h

📁 C语言写的商品信息管理系统 学习数据结构
💻 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 + -