Advertisement
cd62131

Uppercase

Jul 12th, 2014
410
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. #include <cctype>
  2. #include <iostream>
  3. #include <sstream>
  4. #include <string>
  5. using namespace std;
  6. string uppercase(string& s) {
  7.   stringstream out;
  8.   for (auto& e : s)
  9.     out << static_cast<char>(toupper(e));
  10.   return out.str();
  11. }
  12. int main() {
  13.   string s;
  14.   cout << "文字列? ";
  15.   getline(cin, s);
  16.   cout << uppercase(s) << endl;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement