Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#ifndef STACKPAC #define STACKPAC template class Stack { private: T Element[n]; int counter; public: void clearStack() { counter = 0; } bool emptyStack() { if

image text in transcribed

#ifndef STACKPAC

#define STACKPAC

template

class Stack

{

private: T Element[n];

int counter;

public:

void clearStack()

{

counter = 0;

}

bool emptyStack()

{

if (counter == 0) return true;

else return false;

}

bool fullStack()

{

if (counter == n) return true;

else return false;

}

void pushStack(T x)

{

Element[counter] = x;

counter++;

}

T popStack()

{

counter--;

return Element[counter];

}

};

#endif

Please complete the following program using C++. Please use beginner preprocessor directives and "STACKPACK.h library (dont use stdlib.h or bits/stdc++.h). Thank you! Write a program to read an integer number in n and a base (2,8,16 ) in newBase. Convert n from base 10 to newBase. Must use the "STACKPAC.h library. Sample run Enter a number at base 10: 35 Enter a new base (2,8,16): 2 35 base 10 is 100011 base 2 CONTINUE(y)? y Enter a number at base 10: 355 Enter a new base (2,8,16): 8 355 base 10 is 453 base 8 CONTINUE[y)? y Enter a number at base 10: 442 Enter a new base (2,8,16): 16 442 base 10 is 1BA base16 CONTINUE(Y)?n

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

Beyond Big Data Using Social MDM To Drive Deep Customer Insight

Authors: Martin Oberhofer, Eberhard Hechler

1st Edition

0133509796, 9780133509793

More Books

Students also viewed these Databases questions

Question

List the advantages and disadvantages of the payback method.

Answered: 1 week ago