C++ programming Display unique data

Currently I read a text file line by line and find all matching data and display them.

So if my text file data is a below
Bag|30|23Mar2015
Bag|30|23Mar2015
Bag|30|24Mar2015
Bag|30|25Mar2015
Bag|30|23Mar2015

And I wish to display the output as
23Mar2015 90
24Mar2015 30
25Mar2015 30

But currently what I able to do is
23Mar2015 30
23Mar2015 30
24Mar2015 30
25Mar2015 30
23Mar2015 30

How do I add those that have unique date value together and display as one? Can anyone enlighten me?

There are more than one way to do it but the easiest way is probably to use a map, if you know how it works.

http://www.cplusplus.com/reference/map/map/
Hi Peter87, i am quite new to C++, and not sure how does map works, is there any other ways to do the required stuff i need?
Topic archived. No new replies allowed.