954,498 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

tolower

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

Baalzamon
Newbie Poster
3 posts since Sep 2009
Reputation Points: 10
Solved Threads: 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.

StuXYZ
Practically a Master Poster
680 posts since Nov 2008
Reputation Points: 760
Solved Threads: 138
 

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... "?

Baalzamon
Newbie Poster
3 posts since Sep 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You