In 1-3 sentences, describe how you would make a "Function that can test if an arbitrary string is a palindrome if stripped of punctuation", Recursively using C++
Use ispunct() function.
int ispunct(int ch)
ch is the character to be checked. Function returns non-zero value, if ch is punctuation character otherwise zero is returned.
If non-zero value is returned, use string erase() function to remove the character.
str.erase(pos,len)
pos represents the position of the character to be removed. len represents number of characters to be removed from the pos.
3. After removing all punctuation charcters, compare first and last charcters of the substring recursively.
Get Answers For Free
Most questions answered within 1 hours.