Question: I need to add a check to this code for the first letter of each word in the input file. I need to check to

I need to add a check to this code for the first letter of each word in the input file. I need to check to make sure it is a letter, not a number or special character. The letter also must be lowercase. C++ code please. The code should then output is valid for words that fit that criteria and not valid for those that break the rules.

I have a few snippets that were commented out to help me.

Below is my current code:

#include  #include  #include  #include  using namespace std; void printReport(string userText, int vowels, int consonents, int specialCharacters); bool isVowel(char c); //bool isValid(string tester); int main() { ifstream inFile("data1.txt"); string s; char ch; int vowels = 0, consonents = 0, specialCharacters = 0, numbers = 0; while(inFile >> s) { vowels = consonents = specialCharacters = numbers = 0; for (int i = 0; i < static_cast(s.length()); i++) { ch = s[i]; if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) { if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' || ch == 'A' || ch == 'E' || ch == 'I' || ch == 'O' || ch == 'U') { vowels += 1; } else { consonents += 1; } } else if (!(ch >= '0' && ch <= '9')) { specialCharacters += 1; } else if (ch >= '0' && ch <= '9') { numbers += 1; } } cout << s << " " <                        

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!