``Help me to add more code using c/c++ given bellow program that means (( you can input a password and the output checking the password is valid or not and also the password is hard or weak)) the program,s output show....the given password is too strong or strong or weak and also check the password is valid@@

#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;
        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;
        return false ;

If you're going to write this in C++, which you clearly already are, don't use a char array to store the input. Use a C++ std::string, from the <string> header.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.