int count; int entry[MAX]; Write the following functions that do not belong to the class: (a) Function int size(Stack &s) leaves the Stack s unchanged and returns a count of the number of entries in the Stack. (b) Function void deleteAll(Stack &s, stackEntry x) deletes all occurrences (if any) of x from s and leaves the remaining entries in s in the same relative order.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter18: Stacks And Queues
Section: Chapter Questions
Problem 3PE
icon
Related questions
Question
const int MAX = 10000;
class enum errorCode (underflow, overflow, success);
class Stack (
public:
Stack () ({ count = 0; }
errorCode top(int &) const;
errorCode pop ();
errorCode push (int) const;
private:
int count;
on
int entry[MAX];
Write the following functions that do not belong to the class:
(a) Function int size(Stack &s) leaves the Stack s unchanged and returns a count of the
number of entries in the Stack,
(b) Function void deleteAll(Stack &s, stackEntry x) deletes all occurrences (if any) of x from
s and leaves the remaining entries in s in the same relative order.
Transcribed Image Text:const int MAX = 10000; class enum errorCode (underflow, overflow, success); class Stack ( public: Stack () ({ count = 0; } errorCode top(int &) const; errorCode pop (); errorCode push (int) const; private: int count; on int entry[MAX]; Write the following functions that do not belong to the class: (a) Function int size(Stack &s) leaves the Stack s unchanged and returns a count of the number of entries in the Stack, (b) Function void deleteAll(Stack &s, stackEntry x) deletes all occurrences (if any) of x from s and leaves the remaining entries in s in the same relative order.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Stack
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning