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:
like
so you can see in my count[26],I have the occurences.Code:while(cin.get(next)) { for(int i=0;i<26;i++) { if(next=letters[i]) count[i]++; } }
but how to deal with an arbitrary int?