Question: C++: This programming lab makes use of an array of characters. The program will validate the characters in the array to see if they meets
C++:
This programming lab makes use of an array of characters. The program will validate the characters in the array to see if they meets a set of requirements.
Requirements:
Must be at least 6 characters long (but not limited to 6, can be greater)
Contains one upper case letter
Contains one lower case letter
Contains one digit
Complete the code attached. Must use pointer while checking the characters.
#includeusing namespace std; // Global constants const int SIZE = 80; // The maximum size of the array const int MIN = 6; // The minimum number characters // Function prototypes void displayRequirements(); void displayResult(char[]); int main() { char cstring[SIZE]; displayRequirements(); cout << "Enter a password: "; cin.getline(cstring, SIZE); displayResult(cstring); return 0; } void displayRequirements() { // Display the password requirements. cout << "Password Requirments: " << " - The password should be at least " << MIN << " characters long. " << " - The password should contain at least one uppercase " << " and at least one lowercase letter. " << " - The password should have at least one digit. "; } void displayResult(char str[]) { bool length, upper, lower, digit; length = upper = lower = digit = false; int lengthCount = 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
