Using a text editor (i.e. Notepad), create a text file called Text1.txt and place it into a folder of your choosing.
Fill Text1.txt with a sentence and save the file.
Then, write a C++ program that performs the following:
1. Reads the sentence from the file Text1.txt and display it on the screen.
2. Asks the user to enter a lowercase letter (a-z) with the keyboard.
3. Count and display the number of times that the entered letter appears in the sentence read from the file.
This Is What I have so far, dont know how to finish it.
So in real life if you have a sentence "hello world!" on a paper and you want to know how many times the letter l occurs in that sentence, how would you do that?
On a piece of paper, write down EVERY STEP you do to see how many times a letter is in a word. For instance:
look at first letter
is this the letter I am counting?
if it is, add to the count in my head
look at second letter
is this the letter I am counting?
if it is, add to the count in my head
[etc...]
Ok this is what I have so far. I can now input different letters from a to z, but my program isnt counting them and telling my how many "a" is in my sentence, or "b", etc, etc.
Peter87 I want to say thank you for taking time out of your day to help me solve my program. I really appreciate it so much. This is the correction I have made from your last comment. I am almost done, but my program is still not showing me the number of occurrences of the letter, it keeps on giving me 0 each time, just not seeing why.