Question: Language is C++ My code is supposed to read a string of text and check if it is a strict, ordinary, or non-palindrome. I'm struggling
Language is C++
My code is supposed to read a string of text and check if it is a strict, ordinary, or non-palindrome. I'm struggling with getting the program to give the correct output. If you could tell me what I'm doing wrong with my code and explain what would fix it and why that would really help me learn. Please provide screenshots of the code's working output.
MY CODE:
#include
bool Palindrome(string& myString, int start, int end) { int i; if (myString.length() >= 1) return true; if (myString[start] != myString[end]) return false; for (int i = 0; i
string convertUpper(string myString) { int i; for (int i = 0; i
string noPunct(string myString) { int i; string copyStr; for (int i = 0; i
string noSpaces(string myString) { int i; string copyStr; for (int i = 0; i
int main() { bool strict, ordinary; string myString, copyStr; cout
copyStr = convertUpper(myString); copyStr = noPunct(copyStr); cout
strict = Palindrome(copyStr, 0, copyStr.length()-1);
copyStr = noSpaces(copyStr); ordinary = Palindrome(copyStr, 0, copyStr.length() - 1);
if (strict) { cout
MY CODE'S INCORRECT OUTPUT:

MY ASSIGNMENT:


Please enter a string: Not Strict NOT STRICT The entered string is a strict palindrome! WOW A palindrome is a string that reads the same forwards and backwards. A strict palindrome is palindromic includes spaces; in an ordinary palindrome we ignore spaces. Letter case is irrelevant and punctuation is ignored. A palindromic number is composed of only numbers. Able was I, ere I saw Elba. a strict palindrome attributed to Napoleon A man, a plan, a canal: Panama! an ordinary palindrome 2445442 a decimal palindromic number A recursive algorithm to determine whether or not a string is (or is not) a palindrome: Base Case: string length is
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
