Question: My code has for underlined in red and I am not sure why. What am I missing? / / Password Checker Quiz #include #include #include

My code has "for" underlined in red and I am not sure why. What am I missing?
//Password Checker Quiz
#include
#include
#include
#include
using namespace std;
bool isValidPassword(const string& password){
if (password.length()<12){
return false;
}
bool hasUpperCase = false;
bool hasLowerCase = false;
bool hasDigit = false;
bool hasSpecialChar = false;
bool hasNoSpace = false
for (char c : password){
if (isupper(c)){
hasUpperCase = true;
}
else if (islower(c)){
hasLowerCase = true;
}
else if (isdigit(c)){
hasDigit = true;
}
else if (isprint(c) && !isalnum(c)){
hasSpecialChar = true;
}
else if (isspace(c)){
hasNoSpace = true;
}
}
return hasUpperCase && hasLowerCase && hasDigit && hasSpecialChar && hasNoSpace;
}
int main(){
ifstream inputFile("Passwords.txt");
if (!inputFile.is_open()){
cout << "Error opening file." << endl;
return 1;
}
int validCount =0;
int invalidCount =0;
string password;
while (inputFile >> password){
if (isValidPassword(password)){
validCount++;
}
else {
invalidCount++;
}
}
cout << "Total number of valid passwords are "<< validCount << endl;
cout << "Total number if invalid passwords are "<< invalidCount << endl;
inputFile.close();
return 0;
}

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!