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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started