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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started