I'm trying to count different types of characters in a text file "nums.txt" I used a while loop with an ifstream object to check each character individually. Currently, all of my character types (punctuation, digits, uppercases, etc.) correctly display their corresponding number except for the blank space character ' '.
This is what I have in the loop currently:
while (inFile >> inChar){
if (isupper(inChar))
upperCount++;
else if (islower(inChar))
lowerCount++;
// the rest of the char types
else if (isspace(inChar))
spaceCount++;
}
Whenever I run the program, the display shows 0 for number of spaces and I have no idea why. Thanks.