![]() |
|
Technology Computing, programming, science, electronics, telecommunications, etc. |
|
Thread Tools | Display Modes |
![]() |
#27 | ||
Snowflake
Join Date: Mar 2006
Location: Dystopia
Posts: 13,136
|
This is, of course, semantics, but no, it doesn't.
I had a solution to design: how to test for two conditions. I figured, while either one is false, correct that one. Quote:
What could be simpler, or easier to understand? Let's say I am leaving the house. Did I lock the door (a)? Did I turn off the lights (b)? While either one is false: if (a) is false I lock the door, if (b) is false I turn off the lights. When neither one is false I am done. This is common sense. I understand that if I were doing this in the "real world" things would be more involved and this might cease to be feasible for a variety of reasons that I have yet to consider, but in essence, this is my conception of how loops work and what they are supposed to (are DESIGNED to) do. What I don't understand is why you guys find what I did confusing. I used regular, human logic. Quote:
I could put it back this way: Code:
while ((!passLength(password)) || (!containDigit(password))) { if (!passLength(password)) { cout << "Passwords must be at least 6 characters long" << endl; cout << "Please enter a password1: "; cin.getline(password, SIZE); (passLength(password)); //(a) } if (!containDigit(password)) { cout << "Passwords must include at least on digit (1-9)" << endl; cout << "Please enter a password2: "; cin.getline(password, SIZE); (containDigit(password)); //(b) } }
__________________
****************** 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 Last edited by Flint; 11-28-2010 at 08:03 PM. |
||
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|