How do I count how many times each letter in the alphabet occurs in a text file with...

Onions

New member
...C++? I want to store the numbers in an array called letters[26]. So if I outputted letters[0] it would be the number of times 'a' occurs and letters[25] would output the number of times 'z' occurs.
The only way I can think of is to read over the file 26 times. Surely there is a more efficient method.
I want to use an array to do it, not hashtables or anything like that.
 
Back
Top