Posts

Showing posts from October, 2019

Mathematical Expression Evaluation from string in C# using Stack

Mathematical string expression can be evaluate in c# using build in public static double Evaluate(String input)         {             String expression = "(" + input + ")";             Stack<String> operators = new Stack<String>();             Stack<Double> values = new Stack<Double>();             for (int i = 0; i < expression.Length; i++)             {                 String str = expression.Substring(i, 1);                 String prevStr = string.Empty;                 if (i > 1)                     prevStr = expression.Substring(i - 1, 1);                 if (str.E...

Mathematical Expression Evaluation from string in C# using Stack

Mathematical string expression can be evaluate in c# using build in public static double Evaluate(String input)         {             String expression = "(" + input + ")";             Stack<String> operators = new Stack<String>();             Stack<Double> values = new Stack<Double>();             for (int i = 0; i < expression.Length; i++)             {                 String str = expression.Substring(i, 1);                 String prevStr = string.Empty;                 if (i > 1)                     prevStr = expression.Substring(i - 1, 1);                 if (str.E...