예제 #1
0
 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);
 }
예제 #2
0
 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));
 }
예제 #3
0
 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);
 }