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

 #ifndef STACKPAC #define STACKPAC template class Stack { private: T Element[n];

#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

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!