Question: Homework #2 Print A String Forwards and Backwards Task: Develop a program that takes a string as input and then prints the string forwards first

Homework #2

Print A String Forwards and Backwards

Task:

Develop a program that takes a string as input and then prints the string forwards first and then print the same string backwards.

Your main function may look like:

#include

#include

using namespace std;

void print_string_forwards_then_backwards(string str, int begin, int end);

int main()

{

string str;

int len;

cout<< This program will print a string forwards first and then print it backwards ;

cont<< Enter a string: ;

cin >> str;

len = str.size();

print_string_forwards_then_backwards(str, 0, len -1); //index from 0 to len -1

cout<

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!