Reverse a string: Difference between revisions

→‎{{header|C++}}: std::get_line fails in gcc4 on Solaris 10, "error: 'get_line' is not a member of 'std'" : std::getline works
(→‎{{header|C++}}: std::get_line fails in gcc4 on Solaris 10, "error: 'get_line' is not a member of 'std'" : std::getline works)
Line 167:
 
=={{header|C++}}==
 
 
<lang cpp>#include <iostream>
#include <string>
Line 174 ⟶ 176:
{
std::string s;
std::get_linegetline(std::cin, s);
std::reverse(s.begin(), s.end()); // modifies s
std::cout << s << std::endl;
Anonymous user