On Fri, 02 Feb 2007 21:41:32 -0800, Cybex wrote:
Can you have one or the other type conditions for a do while loop?
See the non-working code below...
[snip]
} while(charMstat != 'M' || charMstat != 'N');
This "while" condition will always be true. if charMstat is "M" and
the first part of the condition is false, then charMstat isn't "N", and so
the second part of the condition will be true, and vice versa. This
condition would be false only if charMstat was equal to "M" _and_ it was
equal to "N", which obviously can never happen.
You need to think through your logic again. Under what circumstances do
you want your loop to quit?