How to create, initialize and print unordered multiset in C++

1 Answer

0 votes
#include <iostream>  
#include <unordered_set>

using std::unordered_multiset;
using std::cout;
using std::endl;


void print(const unordered_multiset<int>& usset)
{
	for (const auto& element : usset) {
		cout << element << " ";
	}
	std::cout << std::endl;
}

int main()
{
	unordered_multiset<int> uml = { 1, 2, 3, 5, 88, 99 };

	print(uml);

	return 0;
}

/*
run:

1 2 99 3 5 88

*/

 



answered Jan 14, 2018 by avibootz
edited Jan 15, 2018 by avibootz

Related questions

1 answer 230 views
1 answer 188 views
1 answer 898 views
1 answer 166 views
2 answers 116 views
...