Saturday 15 June 2013

C++ Catch Output -


I have a question about "catching the output" tochers (toller (VaR)); & lt; - This is what I just entered through std :: getline (std :: cin, VAR); I do not want to print this in lower case letters. How can I "hold" this output to not appear at the command prompt?

Example: Input "TeSTIngThis" - & gt; Output: For "test this"

  (unsigned i = 0; i    

It is not clear what you want your loop to be easily rewritten Can be:

  std :: transform (var.begin (), var.end (), var.begin (), [] (four f) {tolower (static_cast & lt; Unsigned four> (ch));})   

If, like most of us, you do not have C ++ 11, then you create a functional object for a toller Will happen . But again, if you need it, you will need it again, and it is understandable to put such functional objects into your toolkit. (This is true even if you have C ++ 11:

  std :: transform (var.begin (), var.end (), var.begin (), toLower ()) ;   

With lambda expression, the form is also clear and straightforward.)

Note that I have terminated the undefined behavior you proposed: call you directly

No comments:

Post a Comment