multiset> mst;
mst.insert(20);
mst.insert(30);
mst.insert(10);
mst.insert(50);
mst.insert(10);

mst.erase(mst.begin(), mst.find(10));
multiset :: iterator itr;
for(itr = mst.begin(); itr != mst.end(); itr++)
cout << *itr << \" \"; cout << endl; cout << mst.count(10); [/sourcecode]

Possible outcome for the above code snippet
(A) 10 10
2
(B) 10
1
(C) 50 30 20 10 10
2
(D) None of these


Answer: (A)

Explanation:
erase(val): removes val from the multiset
mst.erase(mst.begin(), mst.find(10)); – remove all elements up to element with value 10 in mst.

Quiz of this Question


  • Last Updated : 20 Nov, 2018

Share your thoughts in the comments