views:

77

answers:

1

Hai all,

I am doing c#.NET application to calculate different formulas and give result to user,users can enter any formula and each formula values are stored in database like this.

alt text

After saving like this i want to calculate the result.When calculating the result,application ask values for variables.But how can i calculate with this values. Please help to retrieve each values from database and calculate the result.

+2  A: 

You can use Shunting-yard algorithm to convert the expression to postfix notation or to ast directly. See this answer for nice explanation: Equation (expression) parser with precedence

Giorgi
+1: You may want to add these useful links: http://en.wikipedia.org/wiki/Shunting-yard_algorithm and http://en.wikipedia.org/wiki/Postfix_notation
Callum Rogers