Question: C++ Programming!!!! - The palindrome determines whether a string reads the same forward and backward. For example, the string Able was I ere I saw
C++ Programming!!!! - The palindrome determines whether a string reads the same forward and backward. For example, the string Able was I ere I saw Elba is considered a palindrome if we treat both the upper- and lowercase versions of a letter as being the same character. This version of definition of palindrome is actually a string-level palindrome.
In this exercise, you are required to realize word-level palindrome checker program, which means if each word in the input string reads the same forward and backward, then the input string is considered as a word-level palindrome. For example, aba abba is not a string-level palindrome, but it is a word-level palindrome.
Here is the code I have so far! But it doesn't determine if it's a word level Palidrome and thats what I need!!! Will rate! Please help! C++ Programming!!!!
#include // Provides assert
#include // Provides isalpha, toupper
#include // Provides cout, cin, peek
#include // Provides the queue template class
#include // Provides the stack template class
using namespace std;
int main()
{
queue q;
stack s;
char letter;
queue::size_type mismatches = 0; // Mismatches between queue and stack
cout
while (cin.peek() != ' ')
{
cin >> letter;
if (isalpha(letter))
{
q.push(toupper(letter));
s.push(toupper(letter));
}
}
while ((!q.empty()) && (!s.empty()))
{
if (q.front() != s.top())
++mismatches;
q.pop();
s.pop();
}
if (mismatches == 0)
cout
else
cout
cin.ignore(2);
return 0;
}
This is what output is supposed to look like!!!!



PA203-01 Programming Exercises PE21DebuglPE2.exe Enter a line and I will see if it's a word-level palindrome Able was I ere I saw Elba That is not a word-level palindrome
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
