Share your repls and programming experiences

← Back to all posts
A reverse polish caculator, in D!
h
CodeLongAndPros (963)

Today I finished my reverse polish calculator.

It works by pushing elements on the stack.

2 + 3 = 2 3 +

The operations are:

  • +
  • -
  • *
  • /
  • %
  • ^
  • v (sqrt)
  • V (nth root)

You can also use:
P to print the top element
p to print the top element and pop it
f to print all the stack.

Note that the stack size is 255. You can have 256 values on the stack at once.

So long!

Commentshotnewtop
DynamicSquid (2673)

Something isn't right here...

DynamicSquid (2673)

@CodeLongAndPros

Oh really? here, try this:

std::cout << "> P\nsquid\n> ";
std::cin.get();

:)