Hi,
I am trying to start this school assignment where I have to make a C++ program that can operate like one of those old HP-35 calculators. Basically I have some sort of an array where I will use 4 elements which are like the registers on the calculator (X,Y,Z,T). According to the specs of the project the calculator used reverse Polish notation which is a way of computing sums digitally.
Basically if I want the program to calculate 1 + 1, I enter 1 which goes into the x register and 1 again so that the initial 1 gets pushed up the stack into the Y register and then I hit + and the value of the x register gets replaced with the value 2.
I have been given a small bit of skeleton code to go into the main class but it will not compile. It is not accepting the lines of code containing the STL functions like: push() and pop() etc.
I am unsure if I need to include something that isn't there but if anyone could help get me started here I'd appreciate it:
I guess its supposed to be the name of the stack for this particular program in that it is emulating the operations of this old calculator. I tried to substitute your code here only except calling it 'HPstack' instead of 'myStack'. No luck, I get this error message now:
main.cpp:30:36: error: void value not ignored as it ought to be
double x = HPstack.pop();
And prior to that I get this error message regarding line 15:
main.cpp:22:33: error: variable 'std::stringstream expression' has initializer but incomplete type
I didn't get this idea from the internet, it was assigned to me by my university. I'll go have a look and see if I can find some more examples of the same program online if you say that they are there.