12345678
#include <ctype.h> char* stoupper( char* s ) { char* p = s; while (*p = toupper( *p )) p++; return s; }
123456789101112131415
#include <algorithm> #include <cctype> #include <functional> std::string& stoupper( const std::string& s ) { std::string result( s ); std::transform( s.begin(), s.end(), result.begin(), std::ptr_fun <int, int> ( std::toupper ) ); return result; }