Question #38174

write a C++ program that accepts a word from the user and then displays the word after reversing it.

Expert's answer

#include <iostream> #include <conio.h> #include <string>using namespace std;int main()  {          string word;          cout<<"Enter the word you'd like to reverse : ";          getline (cin , word);              cout<<"Here is the reversed word : ";          for (int i = word.size(); i >= 0; i--)              cout<<word[i];                   _getch();           return 0;  }
LATEST TUTORIALS
APPROVED BY CLIENTS