Question: C++, please explain Consider the following declarations: enum errorCode {success, underflow, overflow}; struct ImaginaryNumber{ float real; float imaginary; } struct Node { ImaginaryNumber entry; Node
C++, please explain
Consider the following declarations: enum errorCode {success, underflow, overflow}; struct ImaginaryNumber{ float real; float imaginary; } struct Node { ImaginaryNumber entry; Node *next; }; class Stack { public: Stack() {topNode=NULL;} int size() const; error code top (ImaginaryNumber &item) const; errorCode pop(); errorCode push(const ImaginaryNumber &x); private: Node *topNode; }; (a) Write the following Stack methods: (i) size returns the size of the stack (ii) top - returns the top entry of the stack (iii) pop - removes the first entry of the stack (iv) push - enters an entry at the top of the stack Please note that there is no function empty
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
