0

Sorry in advance if there's already a thread or if i've posted in a wrong section(??).

My question:

If i use the tolower function can i use the newly editted input and put it back to where it came from??
In effect - clarity isn't my strong point today :(
I've got a simple "do" loop that offers a restart option but only if the while criteria !=n is met. I want to get it to either accept 'N' or to read input -> change to lower case -> accept the now lower case.
Did try while ((Choice !='n')||(Choice !='N')); but it got stuck in loop.

Either solution type would be helpful. Muchos er Thankos

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by Baalzamon
0

I think you need either: while(Choice!='n' && Choice!='N') { } Note the && (and).

OR: while(tolower(Choice)!='n') { } Also please note you are very unlikely to need the ; after the while
unless it is in a do { } while (condition); construction.
Whatever you want executed goes in the brackets.

0

Wowzers.
Cheers for the quick reply.
Both options worked exactly as on the tin.
So the && statement reads;
"while choice is not a and choice is not b"
as oppose to
"while choice is not (a and b) then... "?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.