logo CodeStepByStep logo

setMystery

Language/Type: C++ set collections STL

What is the output of the following code? Assume that a set prints in {10, 20, 30} format with its elements in sorted order.

set<int> set;
set.insert(74);
set.insert(12);
set.insert(74);
set.insert(74);
set.insert(43);
set.erase(74);
set.erase(999);
set.erase(43);
set.insert(32);
set.insert(12);
set.insert(9);
set.insert(999);
cout << set << endl;
output
(order shuffled)

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.