Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Trying to fix my stack class I made it has a lot of errors and isn't working and i'm unsure why? Stack Class: #ifndef MYSTACK_H_INCLUDED

Trying to fix my stack class I made it has a lot of errors and isn't working and i'm unsure why?

Stack Class:

#ifndef MYSTACK_H_INCLUDED #define MYSTACK_H_INCLUDED

#include #include using namespace std; template class myStack { public: myStack(); void push(const T& item);

T& top();

int arr_size();

void pop(); private: int size; arr = T[10]; }; template myStack::myStack() { size = 0; } template T& myStack::top() { return arr[size-1]; } template void myStack::push(const T& item) { arr(size) = item; ++size; } template void myStack::pop() { --size; } template myStack::arr_size() { return size; } template bool myStack::isEmpty() { if(top==0) { return true; } else { return false; } }

#endif // MYSTACK_H_INCLUDED

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

Oracle Database 19c DBA By Examples Installation And Administration

Authors: Ravinder Gupta

1st Edition

B09FC7TQJ6, 979-8469226970

More Books

Students also viewed these Databases questions