Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Database Modeling With Neo4j

Authors: Ajit Singh

2nd Edition

B0BDWT2XLR, 979-8351798783

More Books

Students also viewed these Databases questions

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago