Question: PDF code: * / #include using namespace std; / * * Displays the reverse of a non blank string s . @ pre s should

PDF code:
*/
#include
using namespace std;
/** Displays the reverse of a non blank string s.
@ pre s should not be blank.
@ post The reverse of the string s is dispalyed.
*/
void displayBackwards(string);
int main(){
string s;
cout<<" Enter a string -";
cin>>s;
cout<<"Reverse of string "<< s <<"=";
displayBackwards(s);
return 0;
}
/** Displays the reverse of a non blank string s.
@ pre s should not be blank.
@ post The reverse of the string s is dispalyed.
*/
void displayBackwards(string s){
int length = s.size();
if(length==0)//base case
cout<

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!