private double calculateFunc(string funcString, double t) { string[] lex = ParseFunc(funcString); Calculator calculator = new Calculator(); string func = ""; foreach (string lexem in lex) { if (lexem == "T" || lexem == "t") { func += Convert.ToString(t); } else if (lexem == "pi" || lexem == "PI" || lexem == "Pi") { func += Convert.ToString(Math.PI); } else { func += lexem; } } return (double)calculator.calculateString(func); }
private void calculateFunc(string stringFunc, string t) { string[] lex = parseFunc(stringFunc); Calculator calculator = new Calculator(); string func = ""; foreach (string lexem in lex) { if (lexem == "T" || lexem == "t" ) { func += t; } else if (lexem == "pi" || lexem == "PI" || lexem == "Pi") { func += Convert.ToString(Math.PI); } else { func += lexem; } } this.resultLabel.Text = Convert.ToString(calculator.calculateString(func)); }
private float Func(string[] lex, float t) { Calculator calculator = new Calculator(); string func = ""; foreach (string lexem in lex) { if (lexem == "T" || lexem == "t") { func += Convert.ToString(t); } else if (lexem == "pi" || lexem == "PI" || lexem == "Pi") { func += Convert.ToString(Math.PI); } else { func += lexem; } } return (float)calculator.calculateString(func); }