Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help with this C++ Data Structures program. Here are the instructions: Here is stack.h: #ifndef STACKCOMPOSITION_H #define STACKCOMPOSITION_H #include list.h // List class
I need help with this C++ Data Structures program. Here are the instructions:
Here is "stack.h":
#ifndef STACKCOMPOSITION_H #define STACKCOMPOSITION_H #include "list.h" // List class definition template class Stack { public: // no constructor; List constructor does initialization // push calls stackList object's insertAtFront member function void push( const STACKTYPE &data ) { stackList.insertAtFront( data ); } // end function push // pop calls stackList object's removeFromFront member function bool pop( STACKTYPE &data ) { return stackList.removeFromFront( data ); } // end function pop // isStackEmpty calls stackList object's isEmpty member function bool isStackEmpty() const { return stackList.isEmpty(); } // end function isStackEmpty // printStack calls stackList object's print member function void printStack() const { stackList.print(); } // end function printStack private: List stackList; // composed List object }; // end class Stack #endif
Please use Stacks (first in last out) principle to create this program, by using the push and pop operations. Thanks for your assistance!
Filename: palindrome epp Filename: palindrome. cpp Write a program that uses a stack object to determine if a string is a palindrome (i.e. the string is spelled identically backward and forward). The program should ignore spaces and punctuation. Go ahead and start your program by reading in a C-style string from standard input, using the getline function. You may assume a limit of 100 characters on the string (although this can be written, with a little more effort, to accept any size string). Your algorithm must make use of a stack (of type char). Use "stack.h" (you don't need to change this file). Ignore spacing and punctuation, as well as special characters and digits (i.e. only count letters as part of a palindrome, and account for upper/lower case. For example, 'B' and 'b' are matching letters). Sample runs: (user input underlined) Please enter a string: ABCDEFGHGFEDCBA ABCDEFGHGFEDCBA" IS a palindrome Please enter a string: ic .xxvaz" , The quick brown fox" is NOT palindrome Please enter a string: Cig ic. "Cigar? Toss it in a can. It is so tragic." IS a palindrome Since you are reading data into a C-style string to begin, you may use any of the libraries iostream>,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