How to reverse an std::string? [duplicate]
I’m not sure what you mean by a string that contains binary numbers. But for reversing a string (or any STL-compatible container), you can use std::reverse(). std::reverse() operates in place, so you may want to make a copy of the string first: #include <algorithm> #include <iostream> #include <string> int main() { std::string foo(“foo”); std::string copy(foo); … Read more