Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

XML Data Management Native XML And XML Enabled Database Systems

Authors: Akmal Chaudhri, Awais Rashid, Roberto Zicari, John Fuller

1st Edition

ISBN: 0201844524, 978-0201844528

More Books

Students also viewed these Databases questions

Question

Do the roles in the game correspond to business roles?

Answered: 1 week ago

Question

5. Identify three characteristics of the dialectical approach.

Answered: 1 week ago

Question

6. Explain the strengths of a dialectical approach.

Answered: 1 week ago

Question

4. Explain the strengths and weaknesses of each approach.

Answered: 1 week ago