// File: Palindrome.cpp // Determines if words are palindromes #include #include #include "stack.h" // header for Stack -- StackElementType is char using namespace std; int const MAXCHARS=100; bool isPalindrome(string); void main() {string word_as_string; do { cout << "\nEnter a string of up to " << MAXCHARS << " characters (without blanks)\n"; cout << "\tto check for a Palindrome... Hit Return to quit. >"; getline(cin,word_as_string); if (word_as_string.length()>0) if (isPalindrome(word_as_string)) cout << "Yes! This word is a palindrome: "; else cout << "No, sorry, but this word is not a palindrome: "; } while(word_as_string.length()>0); } bool isPalindrome(string word) { Stack s; int i; // build the stack for (i=0;i