[C++] STL Transform练习

// Orz.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include #include #include #include #include using namespace std; string& toLower(string& s) { // Modify each char element transform(s.begin(), s.end(), s.begin(), tolower); return s; } int _tmain(int argc, _TCHAR* argv[]) { vector svec; svec.push_back("Stanley B. Lippman"); svec.push_back("Scott Meyers"); svec.push_back("Nicolai M. Josuttis"); // Modify each string element transform(svec.begin(), svec.end(), svec.begin(), toLower); copy(svec.begin(),svec.end(), ostream_iterator(cout,"/n")); system("pause"); return 0; }

 

练习STL Transform

你可能感兴趣的:(C/C++)