This is a program that tests for password strength. I used simple tests to check the password, but I am having issues. Let me state that I am not very good with c++, so sorry if the error is apparent
#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>
#include <cctype>
using namespace std;
int main()
{
cout << "Please enter your password!" << endl;
cin >> password;
}
bool hasUpp = false;
bool hasLow = false;
bool hasDig = false;
bool hasSym = false;
string strlen, password; //The next line is throwing the error, expecting a declaration
for(int i = 0; < strlen(string1); ++i) //This is where my error is
{
if (isupper(string1[i]))
hasUpp = true;
if (islower(string1[i])) //Do all of these if statements seem correct?
hasLow = true;
if (isdigit(string1[i]))
hasDig = true;
if (issymbol(string1[i]))
hasSym = true;
if (strlen <= 7) //would this be the right way to check for string length?
return false;
if (strlen >= 8)
return true;
}
if (hasLow && hasUpp && hasDig && hasSym)
{
return true;
}
else
{
return false;
}
I am having issues with the for loop towards the top, I can not seem to get rid of this error. I don't know what else to write about it, I can't post this without adding more text though so I'm just going to write more words until it let's me post