LogiQuest
Back to STL
2

What will be the output of the program?

#include <iostream>
using namespace std;
#include <vector>
#include <algorithm>
int main() {
    vector<int> v = {5, 2, 9, 1};
    sort(v.begin(), v.end());
    for (int x : v) cout << x << " ";
    cout << endl;
    return 0;
}
Easy

Discussion (0)

  • No discussion yet. Ask a doubt or share a shortcut.

Log in to join the discussion.