Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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 ( ....... ) // check if pswd[i] is lowercase

hasLower = true;

else if ( ....... ) // check if pswd[i] is uppercase

...... // update the correct boolean variable

else if ( ....... ) // check if pswd[i] is a digit

...... // update the correct boolean variable

..

}

if ( ..... )

return true;

else

return false;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Sybase Database Administrators Handbook

Authors: Brian Hitchcock

1st Edition

0133574776, 978-0133574777

More Books

Students also viewed these Databases questions