On 3 Nov, 08:59, JOYCE <zzzzzz90...@126.comwrote:
* * * *I'm a new learner.I want to know how to make a calculator in C
programming.
I hope someone can help me .Thanks!
It might be easier to start with what's called Reverse Polish
Notation (look it up).
Here expressions to be evaluated (calculated) are written
like this
2 2 + (calculates 2 + 2)
3 4 4 + * (calculates 3 * 4 + 4)
the rules are simple:
Read a symbol
if it's a number push it on a stack
if it's an operator remove the top two items from the stack
and apply the operator. Put the result on the stack
When you run out of symbols print what's on the stack
So you need a stack and a way to read symbols.
good luck!
--
Nick Keighley