### Reverse Polish Notation

Hi! I'm doing this assignment and I'm stuck and dunno how to proceed. Basically I have 3 classes and I'm trying to work with complex numbers.

 ``1234567891011121314151617181920212223`` ``````#ifndef CRpnCalculator_H #define CRpnCalculator_H using namespace std; #include "CComplex.h" class CRpnCalculator { private: CLifoBuffer stack; public: bool pushValue(CComplex const& data); bool popValue(CComplex const& data); void add(); void subtract(); void multiply(); void divide(); }; #endif ``````

 ``1234567891011121314151617181920212223242526`` `````` #ifndef CLIFOBUFFER_H_ #define CLIFOBUFFER_H_ class CLifoBuffer{ private: int m_size; int m_tos; CComplex* m_pBuffer; public: CLifoBuffer(int size=0); ~CLifoBuffer(); void print(); bool push(CComplex const& data); bool pop(CComplex& data); }; #endif ``````

 ``12345678910111213141516171819202122232425262728293031323334353637383940414243444546`` ``````#include #include using namespace std; #ifndef CComplex_H #define CComplex_H class CComplex{ friend CComplex operator+(float lOperand, CComplex const& right); friend CComplex operator-(float lOperand, CComplex const& right); friend CComplex operator*(float lOperand, CComplex const& right); friend CComplex operator/(float lOperand, CComplex const& right); friend ostream& operator<<(ostream& out, CComplex const& c); private: float m_real; float m_imaginary; public: CComplex(float real=0,float imaginary =0); CComplex(CComplex const& c); void set(float real, float imaginary); float abs(); void print(); CComplex operator+(CComplex const& rOperand); CComplex operator+(float rOperand); CComplex operator-(CComplex const& rOperand); CComplex operator-(float rOperand); CComplex operator*(CComplex const& rOperand); CComplex operator*(float rOperand); CComplex operator/(CComplex const& rOperand); CComplex operator/(float rOperand); CComplex& operator++(); //Prefix increment CComplex operator++(int); //Postfix increment }; #endif ``````

Can someone help me with the following question:

Implement pushValue() and popValue(). These methods delegate directly to the
corresponding methods of the stack attribute (the LIFO buffer).
What part do you need help with?
in the main() i would be using an object of the class CRpnCalculator to call the function pushValue().. now that function would be calling the push function of CLifoBuffer class. Now the problem is how do I get to assign the memory of the buffer so that when I call the pushValue() function it would push a complex number CComplex *m_pBuffer and vice versa for pop function.
Topic archived. No new replies allowed.