How do you read single characters

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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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)
  }
Last edited on
Topic archived. No new replies allowed.