in C++ A palindrome is a word, phrase, verse, or sentence that reads the same ba
ID: 3824942 • Letter: I
Question
in C++
A palindrome is a word, phrase, verse, or sentence that reads the same backward or forward. For example: A man, a plan, a canal, Panama!
Ask the user for a string and check to see if it is a palindrome. (Remove all the spaces and punctuation before you check.
Also make sure that you convert everything into the same case, upper or lower case, before you check.
After the palindrome check, if there are any digits in the string, extract them one by one to create a number. (Example: The string “12Heh21” is a palindrome and the number is 1221.) Take the number and multiply it by your age and display the results.
Explanation / Answer
#include <iostream>
#include <string>
using namespace std;
bool isPalindrome(string str)
{
}
int main()
{
string line;
getline(cin, line);
string reducedString = "";
for(int i = 0; i < line.length(); i++)
{
if (isalpha(line[i]))
}
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.