#include<iostream>
#include <vector>
#include <algorithm>

using namespace std;
int N, M;
struct chicken {
	int len, x, y;
};

bool comp(chicken a, chicken b) {
	return a.len < b.len;
}
vector<chicken> arr;
int main() {
	arr.push_back({ 10, 3, 5 });
	arr.push_back({ 5, 1, 4 });
	arr.push_back({ 7, 2, 4 });
	arr.push_back({ 3, 5, 8 });
	sort(arr.begin(), arr.end(), comp);
	for (int i = 0; i < arr.size(); i++) {
		cout << arr[i].len << " " << arr[i].x << " " << arr[i].y << endl;
	}
}

'객체 지향 설계' 카테고리의 다른 글

객체 지향 설계  (0) 2021.09.04
Union  (0) 2018.06.29
Vector-Sort, iterator  (0) 2018.06.28
Operator Overloading, Operator Conversions  (0) 2018.06.28
Class  (0) 2018.06.27