标签:ret 定义 average turn ice algorithm def 法则 ...
//添加函数头
#include <algorithm>
//定义结构体Yoy
typedef struct
{
double totalprice;
double storage;
double averageprice;
}Toy;
Toy toy[1000];
//定义排序法则
bool compare(Toy a,Toy b)
{
return a.averageprice >b.averageprice ;
} //< 升序 >降序
int main()
{
......
sort(toy,toy+N,compare);
......
}
标签:ret 定义 average turn ice algorithm def 法则 ...
原文地址:https://www.cnblogs.com/houchen/p/8964738.html