StackCalculator is a console-application that supports 4 basic invoice types, Sinus, Rollup and Rolldown.

Before speaking of the implementation let’s get the basics of a stack:

A stack is a last in-first out memory (LIFO). The contents of a stack have the same length of bits, e.g. 32 Bits (4 Bytes). New data can be pushed to the stack, and the last pushed value can be popped from the stack.

In C++ the stack is included in the STL (Standard Template Library). The most used methods are:

  • void push(value)
  • void pop()
  • top()

As you can see in the list above, pop() doesn’t return a value, it only pops the value on the top of the stack from the stack. If you want to use the value on the top of the stack you have to call top() and then call pop() to remove the used value from the stack.

let’s go ahead with the implementation …

Warning: count(): Parameter must be an array or an object that implements Countable in /homepages/7/d395059870/htdocs/dp/wp-includes/class-wp-comment-query.php on line 405

Comments are closed.