Hello. This is my problem:
"Write a program that will read in a line of text and output the number of words in the line and the number of occurrences of each letter."
For example, the input line
I say Hi.
should produce output similar to the following:
3 words
1 a
1 h
2 i
1 s
1 y
You have a few options you can use a std::map<char, int> which would be similar to that first digit integer count code I linked too.
You could also have a std::vector<int> occurrences(26, 0); //size 26 array initialized with 0s . You could access the array by doing occurrences[ tolower(input[i]) - 'a' ]. You already have ccytpe included so using tolower is okay.