tolower

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2009
Posts: 3
Reputation: Baalzamon is an unknown quantity at this point 
Solved Threads: 0
Baalzamon Baalzamon is offline Offline
Newbie Poster

tolower

 
0
  #1
Sep 28th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 394
Reputation: StuXYZ is a glorious beacon of light StuXYZ is a glorious beacon of light StuXYZ is a glorious beacon of light StuXYZ is a glorious beacon of light StuXYZ is a glorious beacon of light StuXYZ is a glorious beacon of light 
Solved Threads: 72
StuXYZ StuXYZ is offline Offline
Posting Whiz

Re: tolower

 
0
  #2
Sep 28th, 2009
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.
experience is the most expensive way to learn anything
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 3
Reputation: Baalzamon is an unknown quantity at this point 
Solved Threads: 0
Baalzamon Baalzamon is offline Offline
Newbie Poster

Re: tolower

 
0
  #3
Sep 28th, 2009
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... "?
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC