Last active
June 17, 2020 05:55
-
-
Save 2hanX/051781c3094c5535c323938e3f34cf0f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<string> | |
using namespace std; | |
int main() | |
{ | |
cout << "Enter a word: "; | |
string word; | |
cin >> word; | |
char temp; | |
int i, j; | |
for ( j = 0, i = word.size()-1; j < i; --i, ++j) | |
{ | |
temp = word[i]; | |
word[i] = word[j]; | |
word[j] = temp; | |
} | |
cout << word << "\nDone\n"; | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment