Question: C++ Create stack S with 30 random numbers (include positve and negative numbers ranging from -1000 to 1000) and output the positive numbers #include using
C++
Create stack S with 30 random numbers (include positve and negative numbers ranging from -1000 to 1000) and output the positive numbers
#include
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

Stack A; Stack B; for (int k -61; k
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
