Question PRG-CPP-0042
MediumWhat is the output of this program?
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
vector<int> v = {5, 1, 4, 2};
sort(v.begin(), v.end(), greater<int>());
for (int x : v) cout << x;
return 0;
}
- A.
1245
- B.
5421
- C.
Sign up free to see the answer and a step-by-step explanation.