mattsan #6961(2008/08/03 23:59 GMT) [ C++ ] Rating0/0=0.00
LLでないですし、ぜんぜん短くありませんし、多バイト文字のこと考えられてませんが、例示ということで。
標準入力から入力し、標準出力へ出力します。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#include <cctype> #include <string> #include <iostream> #include <iterator> #include <algorithm> std::string capitalize(const std::string& s) { std::string result(s); if(result.size() > 0) { result[0] = std::toupper(result[0]); } return result; } int main(int, char* []) { std::istream_iterator<std::string> srcBegin(std::cin); std::istream_iterator<std::string> srcEnd; std::ostream_iterator<std::string> dst(std::cout, " "); std::transform(srcBegin, srcEnd, dst, capitalize); return 0; }
Rating0/0=0.00-0+
[ reply ]
mattsan
#6961()
[
C++
]
Rating0/0=0.00
LLでないですし、ぜんぜん短くありませんし、多バイト文字のこと考えられてませんが、例示ということで。
標準入力から入力し、標準出力へ出力します。
Rating0/0=0.00-0+
[ reply ]