I have to write a program that checks to see if the password entered by the user follows the rules of having one digit, one uppercase letter, and one lowercase number. How can I get the program to look at each individual character and then move on to the next character?
This is the generalized example program that my teacher provided.
char ch;
//Get the first character
cin.get( ch );
//While there is data to be processed
while( ch is not a '!' )
{
//While it is not the end of a line
//Note: this while loop will process the password one character at a time
while( ch is not a newline character ) //'\n' or the ASCII value of 10
{
//process the ch character. This should include displaying the character
//AND coding a cascading decision statement that includes calls to each of
//the 'is' functions that are described below
//increment a character counter (this will help determine if the
//password is the proper length)
//Get the next character (this does not need the cout statement)
}
//Code several separate decision statements to determine if the password
//failed to meet any of the criteria specified earlier and display an
//error message for each of the failed criteria
//Determine if the password was valid. If it was, display an appropriate message
//Increment the appropriate valid or invalid password counter
//Get the next character so the process can start over with a brand
//new password (make sure to code the cout statement with the directions
//for the user)
}