fork download
  1. /// Вариант 2.
  2.  
  3. #include <iostream>
  4. #include <string>
  5. #include <cctype>
  6.  
  7. std::string strToUpper(std::string& str);
  8.  
  9. int main()
  10. {
  11. std::string i = "Don't WORRY be HAPPY.";
  12. std::cout << strToUpper(i);
  13.  
  14. return 0;
  15. }
  16.  
  17. std::string strToUpper(std::string& str)
  18. {
  19. for (auto &c : str)
  20. c = toupper(c);
  21. return str;
  22. }
Success #stdin #stdout 0s 3476KB
stdin
Standard input is empty
stdout
DON'T WORRY BE HAPPY.