I must write a program that able to parsing formula. It should work like this example below :
Input : 5x + 7 ^ sin(z) / 2T + 44
Output : Enter value for x , z , t
Input : 2 , 1 ,2
Output : the answer is : something
It should support (+ , * , - , ^ , % , SIN , COS)
I did read this page about Shunting-yard algorithm
And also I know how to convert Infix expression to postfix or prefix.
It is my algorithm :
1 - Give the expression.
2 - If parentheses are balance go to step 3 else show error go to step 1
3 - Find all variables apart from (SIN , COS)
4 - Give variables from input
5 - Replace variables
6 - Prefix the expression and calculate it
7 - Display result in output and close program
Is that right ? I want to implement it in C#
Please suggest me any note might be useful for me.