I keep thinking that there must be something that I'm missing because that seems pretty easy.
So you want an array with 52 elements for each alphabetical character (upper and lower) with each element holding the number of times that character appears in the file correct?
Just make a for loop that runs 52 times and increments to the next letter each time. Then within that for loop have another for loop that goes through every character, checks to see if it matches the currently set character using an if statement, and if it does += 1 to the counter, then when it's done write the counter to the current array element. The outer loop should then pop to the next letter and the next array element.
Quote:I need a method which puts the frequency of each character in the alphabet as a separate entry into an array
So you want an array with 52 elements for each alphabetical character (upper and lower) with each element holding the number of times that character appears in the file correct?
Just make a for loop that runs 52 times and increments to the next letter each time. Then within that for loop have another for loop that goes through every character, checks to see if it matches the currently set character using an if statement, and if it does += 1 to the counter, then when it's done write the counter to the current array element. The outer loop should then pop to the next letter and the next array element.
"Normally if given a choice between doing something and nothing, I’d choose to do nothing. But I would do something if it helps someone else do nothing. I’d work all night if it meant nothing got done."
-Ron Swanson
"I shall be a good politician, even if it kills me. Or if it kills anyone else for that matter. "
-Mark Antony
-Ron Swanson
"I shall be a good politician, even if it kills me. Or if it kills anyone else for that matter. "
-Mark Antony
