posted 3 years ago

Okay guys, here comes the next one :P

I have to make a calculator just for ADDING and MULTIPLICATION, but I have to be aware of the mathematical rules, (dots before lines)... first I have to do multiplications then add...

the format of the numbers will be in in Infix notations: 2+2*2*2*2*2*2+2*2 ...

Any ideas how to be careful around the * and + sign please?

I have to make a calculator just for ADDING and MULTIPLICATION, but I have to be aware of the mathematical rules, (dots before lines)... first I have to do multiplications then add...

the format of the numbers will be in in Infix notations: 2+2*2*2*2*2*2+2*2 ...

Any ideas how to be careful around the * and + sign please?

posted 3 years ago

As Campbell said, you should look up the Shunting Yard algorithm. However, that's usually used to convert infix to postfix, which you

Never heard that one. There is, however, BODMAS.

HIH

Winston

Kaspersky Ukshini wrote:the format of the numbers will be in in Infix notations: 2+2*2*2*2*2*2+2*2 ...

Any ideas how to be careful around the * and + sign please?

As Campbell said, you should look up the Shunting Yard algorithm. However, that's usually used to convert infix to postfix, which you

*then*pass to an RPN calculator (which is basically a glorified stack). However, since in your case you only have two operators to worry about, you could possibly implement it more simply.

(dots before lines)

Never heard that one. There is, however, BODMAS.

HIH

Winston

"Leadership is nature's way of removing morons from the productive flow" - Dogbert

Articles by Winston can be found here