Question: Using C++, Write a program to ask user to enter a password and validity the password. The password should be 8 20 characters long (8

Using C++,

Write a program to ask user to enter a password and validity the password. The password should be 8 20 characters long (8 is included and 20 is included), it should contain at least one uppercase letter and one lower case letter. The password should contain at least one digit, and at least one symbol other than alphabets or numbers. Most importantly, the password may not contain any white space.

Functions:

You will need at least the following functions, please add more if needed. Your main function shouldnt be more than half a page. Notice that most of the functions does not have size as an input parameter (why?).

You should have the following variables in main:

int size = 80;

char * ptrPassword;

Function header

Purpose

char * getInput(const int SIZE)

The function takes user input and save it into the password input parameter

bool checkLength(char * password)

The password must be at least six characters long. And no more than 12 characters long

bool checkCase(char * password)

The password must contain at least one uppercase and at least one lower case letter.

bool checkDigit(char * password)

The password must contain at least one digit.

bool checkSymbol(char * password)

The password must contain at least one symbol that is not alphanumeric.

bool checkWhiteSpace(char * password)

The password may NOT contain any whitespace characters.

The program should ask for a password and then verify that it meets the stated criteria. If it doesnt, the program should display a message telling the user why it fails, and then ask for re-entry until it is correct.

Your program should echo the correct password (shown in the sample output)

Sample Output:

Please enter a password:

123

!!!Error!!! The password is too short.

!!!Error!!! The password should contain at least one upper case

!!!Error!!! The password should contain at least one lower case

!!!Error!!! The password should contain at least one symbol

password

!!!Error!!! The password should contain at least one upper case

!!!Error!!! The password should contain at least one digit

!!!Error!!! The password should contain at least one symbol

Please enter a password:

Password

!!!Error!!! The password should contain at least one digit

!!!Error!!! The password should contain at least one symbol

Please enter a password:

Password1

!!!Error!!! The password should contain at least one symbol

Please enter a password:

Password1 #

!!!Error!!! The password cannot contain a space

Please enter a password:

Password1234$

!!!Correct!!! The password youve entered is: Password1234$

It is imperative that the output of the function matches the sample output above.

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!