Question: C++ write a value returning reverse function that takes a string and returns it in reverse order. This is a test 123! !321 tset a

C++ write a value returning reverse function that takes a string and returns it in reverse order.

This is a test 123! !321 tset a si sihT

This is my code so far. I'm trying to write it in the main function first to make sure it works and then turn it into a value returning function but I'm stuck here.

#include #include #include using namespace std;

int main(){ string s; cout << "Enter a string: "; cin >> s; for(int i = s.length()-1; i>=0; i--){ cout << s[i]; } return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!