public
anonymous / gist:3887821
Created

  • Download Gist
gistfile1.cpp
C++
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#include <iostream>
#include <string>
using namespace std;
 
int main()
{
const string str = "Hello world";
string revStr = "";
 
for (int i = 0, j = str.length(); i < str.length(); j--, i++)
revStr[i] = str[j];
 
for (int i = 0; i < str.length(); i++)
cout << revStr[i];
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.