Question
The files easytest.dat _____________________________________________________________________________________________________________________________________________________ Bob Turkey or Tofu? dad Choose Gratitude noon Hard work has its rewards MOM What goes around comes around. Never odd
The files easytest.dat
_____________________________________________________________________________________________________________________________________________________
Bob Turkey or Tofu? dad Choose Gratitude noon Hard work has its rewards MOM What goes around comes around. Never odd or even Will a hyphe-nated word throw you off? Stressed desserts
_____________________________________________________________________________________________________________________________________________________
and hardertest.dat
_____________________________________________________________________________________________________________________________________________________
Bob Not a pallindrome dad Choose Gratitude noon Hard work has its rewards MOM What goes around comes around. Never odd or even Will a hyphe-nated word throw you off? Stressed desserts A nut for a jar of tuna. Al lets Della call Ed Stella. Amore, Roma. Are we not pure? No, sir! Panamas moody Noriega brags. It is garbage! Irony dooms a mana prisoner up to new era. Borrow or rob? Taco cat Was it a car or a cat I saw? Dennis, Nell, Edna, Leon, Nedra, Anita, Rolf, Nora, Alice, Carol, Leo, Jane, Reed, Dena, Dale, Basil, Rae, Penny, Lana, Dave, Denny, Lena, Ida, Bernadette, Ben, Ray, Lila, Nina, Jo, Ira, Mara, Sara, Mario, Jan, Ina, Lily, Arne, Bette, Dan, Reba, Diane, Lynn, Ed, Eva, Dana, Lynne, Pearl, Isabel, Ada, Ned, Dee, Rena, Joel, Lora, Cecil, Aaron, Flora, Tina, Arden, Noel, and Ellen sinned. Ed, I saw Harpo Marx ram Oprah W. aside. Madam, in Eden, Im Adam. Murder for a jar of red rum. Oozy rat in a sanitary zoo. Yo, banana boy! _____________________________________________________________________________________________________________________________________________________
(posted on Canvas) contain some number of words/phrases (one per line) to be evaluated to see if each one is a palindrome or not. A palindrome is a word or phrase that reads the same from right to left as it does from left to right. For example: the words Bob, dad, noon, MOM are palindromes; the phrases Never odd or even, Stressed desserts are palindromes.
In C++, create a stack class, and use the stack class to help you solve the above problem. Your stack class needs to implement the stack using a dynamically allocated array. Make sure to look at the SimpleList Example code.
_____________________________________________________________________________________________________________________________________________________
/******
ideone.com/41LFjF SimpleList CORRECT
*****/
#include
class SimpleList { public: SimpleList(); SimpleList(const SimpleList& ); ~SimpleList(); const SimpleList& operator=(const SimpleList & right);
void printList()const; void clear(); void add(int newItem); bool member(int anItem)const; int currentSize() const; private: //void makeLarger(); int * listptr; int size; int maxSize; };
int main() { SimpleList myList; myList.add(3); SimpleList secondList = myList; myList.add(4); secondList = myList; myList.add(5); myList.printList(); secondList.printList(); return 0; } SimpleList::SimpleList() { cout << "In null constructor" << endl; listptr = nullptr; size = 0; maxSize = 10; listptr = new int[maxSize]; } SimpleList::SimpleList(const SimpleList& orig) { cout << "In copy constructor" << endl; maxSize = orig.maxSize; listptr = new int[maxSize]; size = orig.size; for(int i = 0; i In null constructor In add In copy constructor In add In assignment operator In add 3 4 5 3 4 Destructor here Destructor here _____________________________________________________________________________________________________________________________________________________ That program illustrates the basics of working with a dynamically allocated array within a class. It also shows the start of how to work with a resize() or makeLarger() member function. Additionally your program should: Your program must use your own stack class to determine if a word/phrase is a palindrome. You are NOT allowed to use the stack in C++ standard template library (STL). Grading The assignment will be graded in accordance with the Labs and Programming Assignment Expectation handout, formatting.txt example, and the "Programming Process CPSC1430 document and the rubric posted on Canvas. Failure to adhere to the guidelines could result in losing points. Submitting your Program You must submit three files:
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