Question: Please help debug the following program and add code to create a menu driven interface for the user in C++: // ConsoleApplication1.cpp : This file

Please help debug the following program and add code to create a menu driven interface for the user in C++:

// ConsoleApplication1.cpp : This file contains the 'main' function. Program execution begins and ends there.

//

#include "pch.h"

#include

template class Stack {

private:

int maxSize;

int top;

E *listArray;

void operator =(const Stack&) {}

Stack(const Stack&) {}

public:

Stack(int size = defaultSize)

{maxSize = size top = 0; listArray = new E[size];}

~Stack() { delete[] listArray; }

virtual void clear() { top = 0; }

virtual void push(const E& it) { Assert(top != maxSize, "Stack is full"); listArray[top++] = it; }

virtual E pop() { Assert(top != 0, "Stack is empty"); return listArray[--top]; }

const E& topValue() const {

Assert(top != 0, "Stack is empty"); return listArray[top - 1];

}

virtual int length() const { return top; }

};

using namespace std;

int main()

{

;}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!