Calculator (double stack)
The pre-knowledges you should know is priority of operator. Priority is the rule that determines when we meet two operators, which to calculate first. Like 3+2*5, we calculate 2 * 5 first.
The priority of operators are:
The pre-knowledges you should know is priority of operator. Priority is the rule that determines when we meet two operators, which to calculate first. Like 3+2*5, we calculate 2 * 5 first.
The priority of operators are:
This is a rounding problem. Since it has only three number after the point, you just need to find the last number n and if it's more than four...