Question: C PROGRAMMING C PROGRAMMING A strong password should contain at least one digit, one lowercase letter, and one uppercase letter. Given below is a function
C PROGRAMMING C PROGRAMMING
A strong password should contain at least one digit, one lowercase letter, and one uppercase letter. Given below is a function that takes in a string and returns true if the string is a strong password and false otherwise. Fill in the spaces in the function implementation. Do not use ctype.h library.
Hint: In ASCII, each char corresponds to a number. The digit characters 0 through 9; the uppercase characters A through Z, and the lowercase letters a through z are consecutive.
bool IsValidPassword( char pswd[] )
{
bool hasLower=false, hasUpper=false, hasDigit=false;
int c, i=0;
while ( pswd[i] != '\0' )
{
c= (int) pswd[i];
if ( ....... )
hasLower = true;
else if ( ....... )
......
else if ( ....... )
......
..
}
if ( ..... )
return true;
else
return false;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
