Using a map to keep a total?

I am trying to figure out a way to use maps to keep a total number of items.

I was using arrays before

total[x] = total[x] + (function to add another int);

Now I made total a map, but have no idea how to get the same result.

Gives me an error.


Any help would be greatly appreciated.
If you just want to keep a total count of things, why do you need an array, map, or anything else besides just one value? I am not sure I understand fully what you want to do here, could you explain more?
I am using it to deal cards, and it needs to be able to add another card on top of it.

There are up to 7 players so I need to be able to keep track.
I think you want more of a vector than a map.
http://www.CPlusPlus.com/vector

A vector makes more sense than a map because maps use a key to get to the value whereas vectors are more like an expandable array-ish thing.
Topic archived. No new replies allowed.