小编use*_*778的帖子

排序算法 C++

#include <iostream>
#include <array>
#include <algorithm>
using namespace std;
class Test
{
private:
    int value;
public:
    Test()
    {
 
    }
    Test(int _value)
    {
        value = _value;
    }
    bool operator<(Test&);
 
};
bool Test::operator<(Test& rValue) {
    return this->value < rValue.value;
}
int main()
{
    Test* arr = new Test[950];
    arr[0] = Test(5);
    arr[1] = Test(10);
    arr[2] = Test(7);
    arr[3] = Test(3);
    arr[4] = Test(10);
    sort(arr, arr + 5, [](Test& a, Test& b) { return a < b ? false : true; });
} …
Run Code Online (Sandbox Code Playgroud)

c++ sorting

3
推荐指数
1
解决办法
73
查看次数

标签 统计

c++ ×1

sorting ×1