I need a code which can solve the equations like this :-
In this we know that brackets must be solved first and then divide/multiply and then add/subtract.
So, i need a code for solving this kind of equations which contains multiple operators in single line.

Thnks :)

6 Years
Discussion Span
Last Post by Rouf mir

I'm not a C programmer but the equasion should be something like:

variable1 = 78/8;
variable2 = (56*78) + variable1;

Deceptikon is right though something as simple as that shouldn't be hard to find on Google

Edited by ChrisHunter


I need a code which can solve the equations like this :-

Nobody is going to just give you the code. To do it properly would involve writing essentially a tiny compiler for mathematical expressions where you tokenize the line, convert it into an expression tree, and parse that tree to evaluate the result. It's not especially difficult, but not trivial either.

A google search will work wonders.


This is simple you can solve it using stacks .You must have heard about postfix and infix notation .You just convert into postfix and then solve it using a stack.
you should get the equation in the form of an array.Hope it will help

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.