c++ - Convert string to all uppercase leters with std::transform -


i'm using transform algorithm , std::toupper achieve this, can done in 1 line, ?

transform(s.begin(), s.end(), ostream_iterator<string>(cout, "\n"),std::toupper); 

i error on this, have make unary function , call transform or can use adaptors ?

use ostream_iterator<char> instead of ostream_iterator<string>:

transform(s.begin(),s.end(),ostream_iterator<char>(cout,"\n"),std::toupper); 

std::transform transforms each character , pass output iterator. why type argument of output iterator should char instead of std::string.

by way, each character printed on newline. want? if not, don't pass "\n".

--

note : may have use ::toupper instead of std::toupper.

see these


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -