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.

I NEED PROGRAM NUMBER 2 IN C++ WITH COMPLETE DOCUMENTATION

THE PROGRAM SHOULD TAKE FILE NAME AS INPUT. READ THE COMPLETE FILE CONTENT INSIDE IT AND GIVE TOTAL NUMBER OF PALINDROMES FOUND AND TOTAL NUMBER OF WORDS PROCESSED AS SHOWN IN THE EXAMPLE OF PROGRAM 2

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

Database Horse Betting The Road To Absolute Horse Racing 2

Authors: NAKAGAWA,YUKIO

1st Edition

B0CFZN219G, 979-8856410593

More Books

Students also viewed these Databases questions

Question

x-3+1, x23 Let f(x) = -*+3, * Answered: 1 week ago

Answered: 1 week ago