Page 1 of 1

Using stack and arithmetic tree

Posted: Fri Jul 10, 2020 5:36 pm
by Feelings
Hi everyone. I am now coding a calculator app but it work only for two numbers.. I mean a+b or a*b. I wondering modify this app it would be possible to calculate on many numbers and create order of operations and maybe it would be good to use stack to contain numbers and then use arithemtic tree?

Re: Using stack and arithmetic tree

Posted: Fri Jul 10, 2020 7:35 pm
by Kvaz1r
Yes you can use tree to create calculator. There are tons of article about creating and evaluating expression tree.
Or you can use some library and not to do all work by yourself.