plz help me to solve the problem..add some more code in c/c++ related to show that the output will be password too strong or strong or weak....
#include <iostream>
#include <cstring>
#include <cctype>
using namespace std;
bool testPass(char []);//function prototype to check password
int main()
{
char *password;
int length; //assure requested length and password length are the same
int numCharacters; //hold number of characters for password
cout << "Please enter how many characters you would like your\npassword to be.";
cout << " Your password must be at least 6 characters long." << endl;
cin >> numCharacters;
while (numCharacters < 6)
{
cout << "Please enter a password length of at least 6 characters." << endl;
cin >> numCharacters;
}
password = new char[numCharacters+1];
cout << "Please enter a password that contains at least one uppercase letter, ";
cout << "one\nlowercase letter, and at least one digit." << endl;
cin >> password;
length = strlen(password);
while (length != numCharacters)
{
cout << "Your password is not the size you requested. ";
cout << "Please re-enter your password." << endl;
cin >> password;
length = strlen(password);
}
if (testPass(password))
cout << "Your password is valid." << endl;
else
{
cout << "Your password is not valid. ";
cout << "Please refer to the above warning message." << endl;
}
delete[] password ;
return 0;
}
/*This function will check each input and ensure that the password
contains a uppercase, lowercase, and digit.*/
bool testPass(char pass[])
{
bool aUpper = false,
aLower = false,
aDigit = false ;
for ( int i = 0 ; pass[i] ; ++i )
if ( isupper(pass[i]) )
aUpper = true ;
else if ( islower(pass[i]) )
aLower = true ;
else if ( isdigit(pass[i]) )
aDigit = true ;
if ( aUpper && aLower && aDigit )
return true;
else
return false ;
}