![]() |
|
Technology Computing, programming, science, electronics, telecommunications, etc. |
|
Thread Tools | Display Modes |
![]() |
#1 | |
Snowflake
Join Date: Mar 2006
Location: Dystopia
Posts: 13,136
|
C++ Help, Please. Thank You.
This program is supposed to check that a password is at least 6 characters AND contains at least one digit. What I never was able to figure out is how to check for BOTH conditions. Since I have them in two functions, once one is satisfied, it drops to the next one and forgets about the other. I didn't know how to get "back" to the previous condition, so I copy/pasted the code in an if/else statement! The if statement was originally supposed to print the "Thank you that is a valid password" but it didn't print, so I put it in again at the bottom.
However, if you put in a correct password at the first prompt, the if statement prints. In the version I am turning in, I told it to print an endl; (it just skips a line). See how the "Please enter a password: ";s are numbered 1 through 4? if you get down to "Please enter a password4: "; and enter 123 it accepts this as valid. It still does not check "also" for length. I don't know how to validate a string of input for two separate conditions. The problem is, when it fails I need it to tell the user why it failed, so I can't just lump them together. I am going cross-eyed. Can anybody tell me what my ignorant mistake is? There are no examples of this in my textbook... Quote:
__________________
****************** There's a level of facility that everyone needs to accomplish, and from there it's a matter of deciding for yourself how important ultra-facility is to your expression. ... I found, like Joseph Campbell said, if you just follow whatever gives you a little joy or excitement or awe, then you're on the right track. . . . . . . . . . . . . . . . . . . . . . . . . . . Terry Bozzio |
|
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|