Hello, I'm trying to write code to count 4, 5, and 6 letter words, within a file. I've spent around 20 hours on a couple of assignments and exausted help from my computer lab as well ;). Not trying to get someone to write the code for me but if you could help me understand why mine isn't currently working I'd appreciate it.
//This program counts all 3, 4, 5, and 6 letter words from a file named QUOTES.TXT.
using namespace std;
I'm guessing that the input file contains something like a sentence with various words. Your code right now seems like it will stop reading from the input file after it gets to the first non-letter character, which is not what you want. You need to use a second while loop outside your current one that will execute your first while loop and your if statements until the end of file is reached.
Do you know how to use strings? While your method can work, doing it with strings woiuld be much simpler.