943,907 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 303
  • C++ RSS
Sep 28th, 2009
0

tolower

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Baalzamon is offline Offline
3 posts
since Sep 2009
Sep 28th, 2009
0

Re: tolower

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.
Reputation Points: 749
Solved Threads: 134
Practically a Master Poster
StuXYZ is offline Offline
660 posts
since Nov 2008
Sep 28th, 2009
0

Re: tolower

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... "?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Baalzamon is offline Offline
3 posts
since Sep 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Help with Class
Next Thread in C++ Forum Timeline: strtok and linked list help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC