Advanced Calculator

Hi there,
I want to program an advanced calculator and need your help. I'd like to enter some more complex expressions like -17+3*4*(4-sqrt(4) and i want, that mathematical operations are done the correct order, so at first 4-sqrt(4) is calculated, then 3*4*2 and then -17 is subtracted.

Problem 1: Convert a string into a mathematical calculation
Problem 2: Calculate in the correct order

How would I do that (I dont expect perfecly precoded calculators from you, just the way how to do it)

Google search just delivers primitive calculations with entry methods like
1
2
3
4
5
Enter first number 1
Enter operator +
Enter second number 2

3

But thats not what i want

Thanks in advance,

Lukas
Last edited on
You can read book "Programming. Principles and Practice using C++" by Bjarne Straustrup where such a calculator is described.
thx
Topic archived. No new replies allowed.