Purchase Solution

C++ code to test for matching brackets and palindromes

Not what you're looking for?

Ask Custom Question

Please help me in writing the code to test the stack class, and enhancing and testing the queue class.

1. Test the stack class by determining if the following strings have matching open and closing () and/or {} and/or [] :

The fourth one is the only one that should not have matching pairs.

2. Please complete the Queue class including following functions:

Write the code to test the queue class by determining if the following strings are char-by-char palindromes:

Please refer to the attached files to use for the input.

Purchase this Solution

Solution Summary

Attached code has been tested compiling and working fine, using the GNU C++ compiler g++ version 4.3.4 . Also, it tests for palindromes via two different implementations. Please note that the attached code is primarily for your understanding and you will need to tweak it (remove/reword comments/code as needed, decide which palindrome testing you want to go ahead with, have a uniform style of comments and coding) in case you plan to use it anywhere.

Solution Preview

Please find the corrected version of your main.cpp along with requested functionality addition attached as 502363.cpp . It has been tested compiling without any warnings and errors using g++ version 4.3.4 using the command "g++ -Wall 502363.cpp" and has been tested with your provided input files.

To test the code, place the executable in same directory as your input files and run it from there. Output generated is pasted below for your verification.

-------------- Output begins ------------------

Testing ...

Purchase this Solution

Free BrainMass Quizzes
C++ Operators

This quiz tests a student's knowledge about C++ operators.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.