Count number!

This is a discussion on Count number! within the C++ Programming forums, part of the General Programming Boards category; Read a list of ints into a array.The output is two-column list,first column is a list of the different
array ...

Count number!

Read a list of ints into a array.The output is two-column list,first column is a list of the different
array elements ;second column is the count of that element occurs.We can assume that there are few than 50 ints.

Ok,the only problem for me is how to count the ints.Compare to letters,I can set up a array called letters[26],then contain from a~z,and use get function to get the char and compare:

1. Read your numbers into the array.
2. Sort the array.
3. Start at the first element.
4. Call the count STL function on that array for the current element we are looking at. Print the element and the count returned.
5. Advance through the array the same number of positions as step 4 returned
5A. If not at the end of the array return to step 4.
5B. If we are at the end, then exit.

"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens

"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens