MULTISETS!

hey guys. really sorry. i'm due for an assignment on multisets. can anyone help me spare an example. no specifics required. just a set on objects like (eggs. shampoo. shopping stuff you know..) and a counter. the stuff on the websites didnt help me much. and i'm down to one weak example programme below. pls help! much appreciated

#include<iostream>
#include<set>
using namespace std;

int main() {
multiset<long> A;

for (int k=1; k<=5; k++) A.insert(k);
A.insert(3);

cout <<"The size of A is " << A.size() << endl;

multiset<long>::iterator ai;
cout << "The elements of A are: ";
for (ai = A.begin(); ai != A.end(); ai++) {
cout << *ai << " ";
}
cout << endl;
return 0;
}
Try the references on this site, they are really good. Here is the reference for multisets: http://www.cplusplus.com/reference/stl/multiset/

Just click the link for the different methods to see how they work and how they are used (examples are at the bottom of each page).
Topic archived. No new replies allowed.