ь

and the c++ question is?

There is the c++ std::sort() which can be used with an appropriate comparator.

http://www.cplusplus.com/reference/algorithm/sort/
1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;

int main()
{
   vector<pair<double,double>> pts = { { 1.5, 2 }, { 0.5, 6.3 }, { 1.5, 1.5 }, { -0.3, 1.5 } };
   sort( pts.begin(), pts.end() );
   for ( auto p : pts ) cout << p.first << ", " << p.second << '\n';
}
Topic archived. No new replies allowed.