Question: Heres a link to the assigment https://www.dropbox.com/s/l1kmck79bhkczik/260Laboratory08SP2018%20%281%29.pdf?dl=0 stackTemplate.cpp #include using namespace std; const int MAXSIZE = 20; class Stack { public: Stack(); bool Empty(); void

Heres a link to the assigment

https://www.dropbox.com/s/l1kmck79bhkczik/260Laboratory08SP2018%20%281%29.pdf?dl=0

stackTemplate.cpp

#include

using namespace std;

const int MAXSIZE = 20;

class Stack {

public:

Stack();

bool Empty();

void Push(int item);

void Pop();

int Top();

void displayStack();

private:

int stk[MAXSIZE];

int top;

};

Stack::Stack() {

top = 0;

}

bool Stack::Empty() {

if (top == 0)

return true;

else

return false;

}

void Stack::Push(int item) {

stk[top] = item;

top++;

}

void Stack::Pop() {

top--;

}

int Stack::Top() {

return stk[top];

}

void Stack::displayStack() {

for (int i = 0; i < top; i++)

cout << stk[i] << " ";

cout << endl << endl << top << endl;

}

StackExercise3Template.cpp

#include

#include

using namespace std;

const int MAXSIZE = 5;

class Stack {

public:

Stack();

bool Empty();

void Push(int item);

void Pop();

int Top();

void displayStack();

private:

int stk[MAXSIZE];

int top;

};

bool isNumber(string, int &);

int calculate(int, int, string);

int main() {

Stack expStack;

string inToken;

int num, oprd1, oprd2, result;

// *** enter your code here - ref to the steps

// *** in the lab sheet.

system("Pause");

return 0;

}

Stack::Stack() {

top = 0;

}

bool Stack::Empty() {

if (top == 0)

return true;

else

return false;

}

void Stack::Push(int item) {

stk[top] = item;

top++;

}

void Stack::Pop() {

top--;

}

int Stack::Top() {

return stk[top];

}

void Stack::displayStack() {

for (int i = 0; i < top; i++)

cout << stk[i] << " ";

cout << endl << endl << top << endl;

}

/* this function will take a string and determine if it is

an integer. The function will return true and store the

integer value to number (a reference parameter). it will

return false otherwise.

*/

bool isNumber(string inStr, int & number){

stringstream ss;

ss << inStr;

number = 0;

ss >> number;

if (ss.good())

return false;

else if (number == 0 && inStr[0] != '0')

return false;

else

return true;

}

/*

This function will use switch statement check the

first charactor in op to see if it is "=".

Then it will calculate and return the result. Assume

there are only 4 operators +, -, *, /

*/

int calculate(int num1, int num2, string op) {

// *** write your code here

}

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!