Reverse a string: Difference between revisions
m
→{{header|C++}}: minor stylistic changes
(→Perl: ext. doc. for reverse() + fix code) |
m (→{{header|C++}}: minor stylistic changes) |
||
Line 893:
=={{header|C++}}==
<syntaxhighlight lang="cpp">#include <
#include <
#include <algorithm>
int main() {
std::string s;
std::getline(std::cin, s);
std::reverse(s.begin(), s.end()); // modifies s
std::cout << s <<
}</syntaxhighlight>
|