Computer Science, asked by manoj2425, 10 months ago

Your friend wants to see the pronunciation of his/ her name when it gets reversed. Help him/ her to find the reversed string using program.

Answers

Answered by gajulapavanhruthik33
16

Answer:

#include<iostream>

#include<string>

#include<algorithm>

using namespace std;

int main()

{

int x,i,n;

string str;

getline(cin,str);

reverse(str.begin(),str.end());

cout<<str;

return 0;

}

Answered by reddyyashodhara
2

Answer:

#include<iostream>

#include<string>

int main()  

{  

 std::string name;

 std::getline (std::cin,name);

 for( std::string::reverse_iterator i = name.rbegin(); i<name.rend(); i++)

 {

   std::cout<<*i;

 }

}

Explanation:

All test cases passed.

Similar questions