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
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
Get step-by-step solutions from verified subject matter experts
