Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //g++ 5.4.0
- #include <algorithm>
- #include <vector>
- #include <iostream>
- #define I 4
- #define J 2
- using namespace std;
- struct matched_row
- {
- int arr[J];
- int max;
- };
- int main()
- {
- int matrix[I][J]{{3, 4}, {5, 6}, {7, 8}, {9, 10}};
- vector<matched_row> matched;
- matched_row mr;
- copy(begin(matrix[2]), end(matrix[2]), begin(mr.arr));
- mr.max = 8;
- matched.push_back(mr);
- copy(begin(matrix[3]), end(matrix[2]), begin(mr.arr));
- mr.max = 10;
- matched.push_back(mr);
- sort(matched.begin(), matched.end(), [](matched_row &i, matched_row &j)->bool{ return (i.max < j.max); });
- cout << matched[0].max;
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement