1
Loading subject content…
Loading subject content…
Loading practice questions…
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;
}What will be the output of the program?
#include <iostream>
#include <string>
using namespace std;
#include <map>
int main() {
map<string, int> m;
m["b"] = 2; m["a"] = 1; m["b"] += 5;
for (auto &p : m) cout << p.first << p.second << " ";
cout << endl;
return 0;
}What will be the output of the program?
#include <iostream>
using namespace std;
#include <vector>
#include <algorithm>
int main() {
vector<int> v = {3, 1, 2};
reverse(v.begin(), v.end());
for (int x : v) cout << x;
cout << endl;
return 0;
}