C++ Exercises: Reverse a string
85. Reverse a String
Write a program in C++ to reverse a string.
Visual Presentation:

Sample Solution:-
C++ Code :
Sample Output:
Reverse a string: ---------------------- Enter a string: w3resource The string in reverse are: ecruoser3w
Flowchart:

For more Practice: Solve these Related Problems:
- Write a C++ program to reverse an input string using a for loop and print the reversed string.
- Write a C++ program that reads a string and reverses it using recursion, then outputs the result.
- Write a C++ program to reverse a string by swapping characters from both ends using pointers.
- Write a C++ program to convert a string to a character array and then reverse the array to display the reversed string.
C++ Code Editor:
Contribute your code and comments through Disqus.
Previous: Write a program in C++ to compute the sum of the digits of an integer using function.
Next: Write a program in C++ to count the letters, spaces, numbers and other characters of an input string.
What is the difficulty level of this exercise?