Question: 1) Write a program that reads a string of characters, pushing each character onto a stack as it is read and simultaneously adding it to

1) Write a program that reads a string of characters, pushing each character onto a stack as it is read and simultaneously adding it to a queue. When the end of the string is encountered the program should use basic stack and queue operations to determine if the string is a palindrome. Your solution must use the STL stack and queue classes.

2) Modify the basic assignment so it queries the user for the name of a file containing one word per line. Open that file, process each word using basic stack and queue operations to determine if it is a palindrome, and if so, print it. Do NOT treat one character strings as a palindrome (so the word a is not a palindrome). At the end report the total number of palindromes found and the total number of words processed. Test your program on the dictionary file found on fang:

/usr/share/dict/web2 That file contains 235924 words so that is what your program should report. For the purpose of this assignment ignore case, so Paap would be a palindrome.

need this to be written in c++ with complete documentation

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!