sort()排序结构体,从大到小
来源:互联网 发布:星际公民2.6.3优化 编辑:程序博客网 时间:2024/06/07 02:51
#include<iostream>
using namespace std;
#include<algorithm>
class point
{
public:
point() :x(0),y(0){};
int x;
int y;
};
bool cmp(point a, point b)
{
return a.x > b.x;
}
int main()
{
point tmpa[2];
tmpa[0].x = 1; tmpa[0].y = 2;
tmpa[1].x = 3; tmpa[1].y = 2;
sort(tmpa, tmpa + 2,cmp);
//cout << a[0] << a[1] << a[2] << endl;
cout << tmpa[0].x << " " << tmpa[0].y << endl;
return 1;
}
using namespace std;
#include<algorithm>
class point
{
public:
point() :x(0),y(0){};
int x;
int y;
};
bool cmp(point a, point b)
{
return a.x > b.x;
}
int main()
{
point tmpa[2];
tmpa[0].x = 1; tmpa[0].y = 2;
tmpa[1].x = 3; tmpa[1].y = 2;
sort(tmpa, tmpa + 2,cmp);
//cout << a[0] << a[1] << a[2] << endl;
cout << tmpa[0].x << " " << tmpa[0].y << endl;
return 1;
}
0 0
- sort()排序结构体,从大到小
- 结构体排序,sort排序,c++sort
- c++ sort()结构体排序
- sort 对结构体排序
- qsort sort 结构体排序
- 结构体sort快速排序
- sort对结构体排序
- 【结构体】【sort】多重排序
- 结构体排序,使用sort
- EXCEL排序(sort结构体排序)
- sort函数与结构体体排序
- STL中的sort对结构体排序
- qsort 与 sort 对结构体排序
- C++使用sort对于结构体排序
- sort函数结构体二级排序
- vector sort结构体排序要点
- 结构体-排序 sort() swap()
- hdoj1862 EXCEL排序(sort、结构体)
- org.apache.commons.fileupload实现文件上传
- UINavigationController学习记录
- PostgreSQL 字符串操作函数[转]
- 折纸游戏
- JSP九大内置对象及四个作用域
- sort()排序结构体,从大到小
- LESS CSS 框架简介
- 借助docker技术提高研发效率
- 7.11
- wordpress 时区设置问题,相差8个小时
- 简单的介绍下Swift高级语法学习
- Openvswitch使用
- 什么时候使用静态
- java静态方法、非静态代码块{}、静态代码块static{}