Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(in c++, without using #include <iostream.h>, <stdio.h>, <conio.h> or <assert.h>

ID: 3676198 • Letter: #

Question

(in c++, without using #include <iostream.h>, <stdio.h>, <conio.h> or <assert.h>)

Write a recursive function that returns true if an input string is a palindrome and false if it is not. You can do this by checking if the first character equals the last character, and if so, make a recursive call with the input string minus the first and last characters. You will have to define a suitable stopping condition.

Then write a program that takes in a string as user input, then calls the above function and outputs the result. Input string may have characters and numbers. Ignore case when comparing two chracters.

The program should print a string of text to the terminal before getting the inputs from the user. A session should look like one of the following examples (including whitespace and formatting):

The strings printed by the program should include a newline at the end, but no other trailing whitespace (whitespace at the end of the line).

Explanation / Answer

#include using namespace std; bool palindrome (string& sentence,int first=0,int last=string::npos) { if (last==string::npos) last=sentence.length()-1; if (sentence[first]==sentence[last]) { if ((last-first)