Hi,
Im currently working with multimap in C++. So for example i got a multimap like
this:
m.insert(pair<const char* const, int>("a", 1));
m.insert(pair<const char* const, int>("c", 2));
m.insert(pair<const char* const, int>("b", 3));
m.insert(pair<const char* const, int>("b", 4));
m.insert(pair<const char* const, int>("a", 5));
m.insert(pair<const char* const, int>("b", 6));
and i want to loop it but without repeating the same key eg: I want to print
average of each key and print like this
a = 3
b = 6.3
c = 2
My current solution is loop each key and find all other value with the same
key. So its like a loop in loop. But the problem is I print a twice, b three
times, and C once. How can I skip the repetition so it wont print the same key
again?
Thank you