Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

reverse c++ string

#include <algorithm>
#include <iostream>
#include <string>

int main()
{
    std::string foo("foo");
    std::string copy(foo);
    std::cout << foo << '
' << copy << '
';

    std::reverse(copy.begin(), copy.end());
    std::cout << foo << '
' << copy << '
';
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #reverse #string
ADD COMMENT
Topic
Name
2+2 =