String^ s = "reverse me"; array<Char>^ sa = s->ToCharArray(); Array::Reverse(sa); String^ sr = gcnew String(sa);
using namespace System;
int main() { String^ s = "reverse me"; array<Char>^ sa = s->ToCharArray(); Array::Reverse(sa); String^ sr = gcnew String(sa); Console::WriteLine(sr); }
cpp
std::string s = "reverse me"; std::reverse(s.begin(), s.end());
#include <string> #include <algorithm>
int main() { std::string s = "reverse me"; std::reverse(s.begin(), s.end()); }
cpp
std::string s = "reverse me"; std::string sr(s.rbegin(), s.rend());
#include <string>
int main() { std::string s = "reverse me"; std::string sr(s.rbegin(), s.rend()); }