Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- using namespace std;
- typedef struct point{
- int x, y;
- };
- int n;
- point a[1000];
- void getData()
- {
- cin >> n;
- for(int i=1; i<=n; i++)
- cin >> a[i].x >> a[i].y;
- }
- void inMang()
- {
- for(int i=1; i<=n; i++)
- cout << a[i].x << ", " << a[i].y << endl;
- }
- bool _comp(point a, point b){
- return a.x > b.x;
- }
- int main()
- {
- getData();
- // Do mang danh so tu` 1..n
- cout << "Truoc khi sx" << endl;
- inMang();
- sort(a+1, a+(n+1), _comp);
- cout << "Sau khi sx" << endl;
- inMang();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement