I'm having some trouble at the moment I believe with either accessing characters within a string or with comparing the character found with the expected character. I'll post the code below:
This is just a sample of the oode. I have tried both line[j] and line.at(j). The program is intended to count the number of each characters within a text file, however currently it is counting all the characters as the character 'a'. Thanks for the help.
You need to explicitly test each value, if (line[j]=='a' || line[j]=='A'){
The program is intended to count the number of each characters within a text file,
If you need to extend this code to every possible character, the program could become very lengthy. You might want to consider other approaches, such as using tolower() to convert each character to lowercase, and perhaps use an array or a std::map for the accumulation.