Question
Hello I am new to C++ and need help writing a program that uses nodes to create a stack. The end program will have hard
Hello I am new to C++ and need help writing a program that uses nodes to create a stack. The end program will have hard coded strings that will need to be placed in this stack character by character. The stack will then be flipped and returned so that I can see if the strings are pallendromes. I just need help implementing the stack and node class however. I need code for the main.cpp, stack.cpp and stack.h. below is a uml diagram of the classes. If you could use basic c++ coding that would be really helpful so that I can understand what is going on.
Node Attributes Name Data Below Data Type Purpose Character Stores the data of the node, which is a character. Node Pointer Points to the node "below" it in the stack (i.e. equivalent to the "next" reference.) Methods Name Constructor Return Type Parameters None None Empty Constructor that initializes the attributes to default values. Data should be empty, (i.e. two empty single quotes) and below should be NULL. Data: character Non-Empty constructor that initializes Below: Node Pointer Constructor None the node to store its data and specify the node below it. Stack Attributes Name top Data Type Purpose Node Pointer Top of stack points to node that was last pushed onto the stack. Integer Variable that keeps track of the count of items on the stack. size Methods Name Constructor eturn Type Parameters None Purpose Empty Constructor that initializes the attributes to default values. Top should point to null and size should be zero. Non-Empty constructor that initializes the stack to have one node pushed onto it. None Constructor None Data: character Push Pop ToString None Data: character Performs the insert operation on the character Performs the remove operation on the stack that follows the LIFO principle Pops off each item of the stack, storing each character in a string in the order of each pop, returning the string after None String NoneStep 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