Kyaria

Code für die Welt!

Apr 20th, 2018
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 22.30 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Text.RegularExpressions;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11.  
  12. namespace Funktionsplotter
  13. {
  14.     public partial class Form1 : Form
  15.     {
  16.         private Bitmap bmp;
  17.         private Pen blackPen, redPen, greenPen, violetPen;
  18.         private PointF[] point_a = new PointF[2000];
  19.         private PointF[] point_b = new PointF[2000];
  20.         private PointF[] point_c = new PointF[2000];
  21.         private PointF[] point_d = new PointF[2000]; // Punktearrays für die Funktion und die Ableitungen
  22.         private int counter_ableitungen = 0, count_saver = 0; // Counter um Ausgabe-Ableitung zu steuern
  23.         private string func_a, func_b, func_c, func_d; // Die Funktionen werden hier gespeichert
  24.  
  25.         public Form1()
  26.         {
  27.             InitializeComponent();
  28.  
  29.             textBox3.Enabled = false;
  30.             textBox6.Enabled = false;
  31.             textBox7.Enabled = false;
  32.  
  33.             init_pic(); // Achsenkreuz wird erstellt
  34.         }
  35.  
  36.         private void button2_Click(object sender, EventArgs e) // Grafik wird auf dem Desktop gesichert
  37.         {
  38.             string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
  39.             count_saver++;
  40.  
  41.             pictureBox1.Image.Save(path + "/bitmap_grafik_" + count_saver + ".bmp", System.Drawing.Imaging.ImageFormat.Bmp);
  42.         }
  43.  
  44.         private void button1_Click(object sender, EventArgs e)
  45.         { // Formt Eingabe zur Normalform um
  46.             textBox3.Clear();
  47.             textBox6.Clear();
  48.             textBox7.Clear();
  49.             listBox2.Items.Clear();
  50.             init_pic();
  51.             counter_ableitungen = 0; // Counter um die Ausgabe nach Ableitungen zu leiten
  52.  
  53.             if (richTextBox1.Text != "" && textBox1.Text != "" && textBox2.Text != "" && Convert.ToDouble(textBox1.Text) > Convert.ToDouble(textBox2.Text))
  54.             { // Überprüft Eingabe auf Richtigkeit
  55.                 string str = richTextBox1.Text;
  56.  
  57.                 if (str[0] != '+' && str[0] != '-') str = '+' + str; // Wenn kein Rechenzeichen am Beginn des Strings steht, wird eins hinzugefügt
  58.  
  59.                 for (int i = 0; i < str.Length; i++) // Überprüft ob ein einzelnes X in der Funktion ist und setzt ein ^1 ein
  60.                 {
  61.                     if (str[i] == 'x' && str[i + 1] != '²' && str[i + 1] != '³')
  62.                     {
  63.                         str = str.Insert(i + 1, "¹");
  64.                     }
  65.                 }
  66.  
  67.                 if (!str.Contains('³')) // Wenn kein x³ vorhanden wird eines eingefügt
  68.                 {
  69.                     str = str.Insert(0, "0x³");
  70.                 }
  71.  
  72.                 if (str.Contains('³') && !str.Contains('²')) // Wenn kein x² vorhanden, so wird eines an der passenden Stelle eingefügt
  73.                 {
  74.                     for (int i = 0; i < str.Length; i++)
  75.                     {
  76.                         if (str[i] == 'x' && str[i + 1] == '³')
  77.                             str = str.Insert(i + 2, "+0x²");
  78.                     }
  79.                 }
  80.  
  81.                 if (str.Contains('²') && !str.Contains('¹')) // Wenn kein x^1 vorhanden ist wird eines eingefügt
  82.                 {
  83.                     for (int i = 0; i < str.Length; i++)
  84.                     {
  85.                         if (str[i] == 'x' && str[i + 1] == '²')
  86.                             str = str.Insert(i + 2, "+0x¹");
  87.                     }
  88.                 }
  89.  
  90.                 for (int i = 0; i < str.Length; i++) // Setzt ein 'd' ein wenn nicht vorhanden
  91.                 {
  92.                     if (str[i] == '¹')
  93.                     {
  94.                         if ((i + 1) >= str.Length)
  95.                         {
  96.                             str = str.Insert(i + 1, "+0");
  97.                         }
  98.                     }
  99.                 }
  100.  
  101.                 string new_string_two = str;
  102.                 int new_count_two = 0;
  103.  
  104.                 for (int i = 0; i < str.Length; i++) // Wenn x alleine steht wird eine 1 hinzugefügt
  105.                 {
  106.                     if (str[i] == 'x')
  107.                     {
  108.                         if (!Char.IsDigit((str[i - 1])))
  109.                         {
  110.                             new_string_two = new_string_two.Insert(i - new_count_two, "1");
  111.                             new_count_two++;
  112.                         }
  113.                     }
  114.                 }
  115.  
  116.                 str = new_string_two;
  117.  
  118.                 string new_string = str;
  119.                 int new_count = 0;
  120.  
  121.                 for (int i = 0; i < str.Length; i++) // Setzt vor ein x ein *
  122.                 {
  123.                     if (str[i] == 'x')
  124.                     {
  125.                         new_string = new_string.Insert(i + new_count, "*");
  126.                         new_count++;
  127.                     }
  128.                 }
  129.  
  130.                 str = new_string;
  131.  
  132.                 func_a = str; // Original Funktion wird in func_a gesichert
  133.                 calc_ableitung(str); // Zur Ableitungsfunktion
  134.                 draw_stuff(); // Nach den Ableitungen wird der Zeichnenmethode übergeben
  135.             }
  136.             else
  137.             {
  138.                 MessageBox.Show("Bitte geben Sie eine gültige Funktion 3. Grades und gültige Grenzen ein!");
  139.             }
  140.         }
  141.  
  142.         private void draw_stuff() // Zeichnet meine Funktionen
  143.         {
  144.             bool calc_b_check = false, calc_c_check = false, calc_d_check = false;
  145.  
  146.             for (int i = 0; i < func_b.Length; i++)
  147.             { // Überprüft ob Funktion Zeichenbar ist. (a, b, c oder d nicht null)
  148.                 if (Char.IsDigit(func_b[i]))
  149.                 {
  150.                     if (func_b[i] != '0') calc_b_check = true;
  151.                 }
  152.             }
  153.  
  154.             for (int i = 0; i < func_c.Length; i++)
  155.             { // Überprüft ob Funktion Zeichenbar ist. (a, b, c oder d nicht null)
  156.                 if (Char.IsDigit(func_c[i]))
  157.                 {
  158.                     if (func_c[i] != '0') calc_c_check = true;
  159.                 }
  160.             }
  161.  
  162.             for (int i = 0; i < func_d.Length; i++)
  163.             { // Überprüft ob Funktion Zeichenbar ist. (a, b, c oder d nicht null)
  164.                 if (Char.IsDigit(func_d[i]))
  165.                 {
  166.                     if (func_d[i] != '0') calc_d_check = true;
  167.                 }
  168.             }
  169.  
  170.             for (int i = -1000; i < 1000; i++)// Rechnet das Punktearray der Originalfunktion
  171.             {
  172.                 string question = func_a.Replace("x", "(" + i.ToString() + ")");
  173.  
  174.                 float py = Convert.ToSingle(rechne_funktion(question)), px = i;
  175.  
  176.                 if (i < 0) py = py * -1; // Der Workaround von dem unten geredet wird. (Bei der Rechnenfunktion)
  177.  
  178.                 if (i >= Convert.ToInt32(textBox2.Text) && i <= Convert.ToInt32(textBox1.Text))
  179.                 {
  180.                     listBox2.Items.Add("y= " + py + ", x= " + px);
  181.                 }
  182.  
  183.                 point_a[i + 1000] = new PointF(px, py);
  184.             }
  185.  
  186.             if (calc_b_check) // Überprüft ob Rechnen sinnvoll ist
  187.             {
  188.                 listBox2.Items.Add("Ableitung 1: \n");
  189.                 for (int i = -1000; i < 1000; i++)// Rechnet das Punktearray der ersten Ableitung
  190.                 {
  191.                     string question = func_b.Replace("x", "(" + i.ToString() + ")");
  192.  
  193.                     float py = Convert.ToSingle(rechne_funktion(question)), px = i;
  194.  
  195.                     if (i < 0) py = py * -1; // Der Workaround von dem unten geredet wird. (Bei der Rechnenfunktion)
  196.  
  197.                     if (i >= Convert.ToInt32(textBox2.Text) && i <= Convert.ToInt32(textBox1.Text))
  198.                     {
  199.                         listBox2.Items.Add("y= " + py + ", x= " + px);
  200.                     }
  201.  
  202.                     point_b[i + 1000] = new PointF(px, py);
  203.                 }
  204.             }
  205.  
  206.             if (calc_c_check) // Überprüft ob Rechnen sinnvoll ist
  207.             {
  208.                 listBox2.Items.Add("Ableitung 2: \n");
  209.                 for (int i = -1000; i < 1000; i++)// Rechnet das Punktearray der zeiten Ableitung
  210.                 {
  211.                     string question = func_c.Replace("x", "(" + i.ToString() + ")");
  212.  
  213.                     float py = Convert.ToSingle(rechne_funktion(question)), px = i;
  214.  
  215.                     if (i < 0) py = py * -1; // Der Workaround von dem unten geredet wird. (Bei der Rechnenfunktion)
  216.  
  217.                     if (i >= Convert.ToInt32(textBox2.Text) && i <= Convert.ToInt32(textBox1.Text))
  218.                     {
  219.                         listBox2.Items.Add("y= " + py + ", x= " + px);
  220.                     }
  221.  
  222.                     point_c[i + 1000] = new PointF(px, py);
  223.                 }
  224.             }
  225.  
  226.             if (calc_d_check) // Überprüft ob das Zeichnen sinnvoll ist
  227.             {
  228.                 listBox2.Items.Add("Ableitung 3: \n");
  229.                 for (int i = -1000; i < 1000; i++)// Rechnet das Punktearray der dritten Ableitung
  230.                 {
  231.                     string question = func_d.Replace("x", "(" + i.ToString() + ")");
  232.  
  233.                     float py = Convert.ToSingle(rechne_funktion(question)), px = i;
  234.  
  235.                     if (i < 0) py = py * -1; // Der Workaround von dem unten geredet wird. (Bei der Rechnenfunktion)
  236.  
  237.                     if (i >= Convert.ToInt32(textBox2.Text) && i <= Convert.ToInt32(textBox1.Text))
  238.                     {
  239.                         listBox2.Items.Add("y= " + py + ", x= " + px);
  240.                     }
  241.  
  242.                     point_d[i + 1000] = new PointF(px, py);
  243.                 }
  244.             }
  245.  
  246.             draw_my_field(); // Übergibt an die Zeichnenfunktion
  247.         }
  248.  
  249.         private void calc_ableitung(string str)
  250.         { // Berechnet Ableitungen
  251.             char calc_sym_1 = str[0], calc_sym_2 = '+', calc_sym_3 = '+';
  252.  
  253.             for (int i = 0; i < str.Length; i++) // Nimmt Rechenzeichen nach der Hochzahl
  254.             {
  255.                 try // Fliegt aus dem Indexbereich wenn ³ z.B. nicht vorhanden ist. Führt zu keinen Problemen im übrigen Code.
  256.                 {
  257.                     if (str[i] == '³')
  258.                         calc_sym_2 = str[i + 1];
  259.  
  260.                     if (str[i] == '²')
  261.                         calc_sym_3 = str[i + 1];
  262.                 }catch { }
  263.  
  264.             }
  265.  
  266.             string[] str_content = str.Split('+', '-');
  267.  
  268.             int multiplikator = 0;
  269.             string erg = "";
  270.  
  271.             for (int i = 0; i < str_content.Length - 1; i++) // Geht der Länge des arrays nach durch die Splits um abzuleiten
  272.             {
  273.                 for (int j = 0; j < str_content[i].Length ; j++) // Checkt jeden Part der Funktion nach Hochzeichen um ableiten zu können
  274.                 {
  275.                     string new_str_content = str_content[i];
  276.  
  277.                     if (new_str_content[j] == '³')
  278.                     { // Wenn im Part dieses Hochzeichen gefunden wurde so wird abgeleitet
  279.                         multiplikator = 3;
  280.                         string[] new_str_array = new_str_content.Split('*');
  281.                         string ins = calc_sym_1 + new_str_array[0]; // Nimmt Rechenzeichen vor dem ^3 und verbindet es mit der Zahl vor dem *
  282.  
  283.                         double varia = Convert.ToDouble(ins) * multiplikator; // Rechnet die neue Basis aus
  284.  
  285.                         erg = erg + calc_sym_1 + varia.ToString() + "*x²"; // Fügt den neuen Exponenten an
  286.                     }
  287.                     if (new_str_content[j] == '²')
  288.                     {
  289.                         multiplikator = 2;
  290.                         string[] new_str_array = new_str_content.Split('*');
  291.                         string ins = calc_sym_2 + new_str_array[0];
  292.  
  293.                         double varia = Convert.ToDouble(ins) * multiplikator;
  294.  
  295.                         erg = erg + calc_sym_2 + varia.ToString() + "*x¹";
  296.                     }
  297.                     if (new_str_content[j] == '¹')
  298.                     {
  299.                         multiplikator = 1;
  300.                         string[] new_str_array = new_str_content.Split('*');
  301.                         string ins = calc_sym_3 + new_str_array[0];
  302.  
  303.                         double varia = Convert.ToDouble(ins) * multiplikator;
  304.  
  305.                         erg = erg + calc_sym_3 + varia.ToString();
  306.                     }
  307.                 }
  308.                
  309.             }
  310.             if (erg.Contains('x')) calc_ableitung(erg); // Wenn  noch Xe vorhanden sind, so wird die Ableitungsfunktion noch einmal aufgerufen
  311.             counter_ableitungen++;
  312.  
  313.             if (erg != "" && counter_ableitungen == 1)
  314.             { // Fügt 3te Ableitung ein
  315.                 textBox7.Text = erg;
  316.                 func_d = erg;
  317.             }
  318.  
  319.             if (erg != "" && counter_ableitungen == 2)
  320.             { // Fügt 2te Ableitung ein
  321.                 textBox6.Text = erg;
  322.                 func_c = erg;
  323.             }
  324.  
  325.             if (erg != "" && counter_ableitungen == 3)
  326.             { // Fügt 1te Ableitung ein
  327.                 textBox3.Text = erg;
  328.                 func_b = erg;
  329.             }
  330.         }
  331.  
  332.         private void draw_my_field() // Zeichnet meine Punktearrays
  333.         {
  334.             blackPen = new Pen(System.Drawing.Color.Black);
  335.             redPen = new Pen(System.Drawing.Color.Red);
  336.             greenPen = new Pen(System.Drawing.Color.Green);
  337.             violetPen = new Pen(System.Drawing.Color.Violet);
  338.  
  339.             using (Graphics g = Graphics.FromImage(bmp))
  340.             {
  341.                 g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; // Kantenglättung
  342.                 g.TranslateTransform(pictureBox1.Width / 2, pictureBox1.Height / 2); // Koordinatensystem Ursprung wird verlegt
  343.                 g.ScaleTransform(1, -0.25F); // Skalierung
  344.                 g.DrawLines(blackPen, point_a); // Originalfunktion
  345.                 g.DrawLines(redPen, point_b); // Erste Ableitung
  346.                 g.DrawLines(greenPen, point_c); // Zweite Ableitung
  347.                 g.DrawLines(violetPen, point_d); // Dritte Ableitung
  348.             }
  349.             pictureBox1.Image = bmp; // Bild wird eingefügt
  350.         }
  351.  
  352.         private void init_pic() // Achsenkreuz wird erstellt
  353.         {
  354.             blackPen = new Pen(Color.Black, 3);
  355.  
  356.             // Create points that define line.
  357.             Point point1y = new Point(pictureBox1.Width / 2, 0);
  358.             Point point2y = new Point(pictureBox1.Width / 2, pictureBox1.Height);
  359.  
  360.             Point point1x = new Point(0, pictureBox1.Height / 2);
  361.             Point point2x = new Point(pictureBox1.Width, pictureBox1.Height / 2);
  362.  
  363.             // Draw lines to screen.
  364.             bmp = new Bitmap(pictureBox1.Width, pictureBox1.Height);
  365.  
  366.             using (Graphics g = Graphics.FromImage(bmp))
  367.             {
  368.                 g.Clear(Color.White);
  369.                 g.DrawImage(bmp, 0, 0); // Zeichnet bmp weiß
  370.  
  371.                 for (int x = -250; x <= 500; x += 25)
  372.                 { // Raster X Achse
  373.                     g.DrawLine(new Pen(Color.Green), x, -pictureBox1.Height, x, pictureBox1.Height);
  374.                 }
  375.  
  376.                 for (int y = -250; y <= 500; y += 25)
  377.                 { // Raster Y Achse
  378.                     g.DrawLine(new Pen(Color.Red), -pictureBox1.Width, y, pictureBox1.Width, y);
  379.                 }
  380.  
  381.                 g.DrawLine(blackPen, point1y, point2y);
  382.                 g.DrawLine(blackPen, point1x, point2x); // Achsenkreuz
  383.             }
  384.  
  385.             pictureBox1.Image = bmp;
  386.         }
  387.  
  388.         private double rechne_funktion(string str)
  389.         {   // BSP: 2*(3)²+1*(-2)¹-3
  390.             string[] calc_array = str.Split('³', '²', '¹');
  391.             bool calc_1_check = false, calc_2_check = false, calc_3_check = false;
  392.  
  393.             for (int i = 0; i < str.Length; i++)
  394.             { // Checkt Funktion auf vorhandene Grade
  395.                 if (str[i] == '¹')
  396.                     calc_1_check = true;
  397.  
  398.                 if (str[i] == '²')
  399.                     calc_2_check = true;
  400.  
  401.                 if (str[i] == '³')
  402.                     calc_3_check = true;
  403.             }
  404.  
  405.             int pow = 0; // Zahl zum hochnehmen
  406.             int begin_index = 0, end_index = 0;
  407.  
  408.             for (int i = 0; i < calc_array.Length; i++) // Geht Array durch
  409.             {// BSP: 2*(3)²+1*(-2)¹-3
  410.                 for (int j = 0; j < calc_array[i].Length; j++) // Geht Teil i des Arrays durch
  411.                 {
  412.                     string new_array = calc_array[i];
  413.  
  414.                     if (new_array[j] == '(')
  415.                     {
  416.                         begin_index = j;
  417.                     }
  418.  
  419.                     if (new_array[j] == ')')
  420.                     { // Checkt nach Klammern
  421.                         end_index = j;
  422.  
  423.                         if (calc_1_check)
  424.                         {
  425.                             pow = 1;
  426.                             calc_1_check = false;
  427.                         }
  428.  
  429.                         if (calc_2_check)
  430.                         {
  431.                             pow = 2;
  432.                             calc_2_check = false;
  433.                         }
  434.  
  435.                         if (calc_3_check)
  436.                         {
  437.                             pow = 3;
  438.                             calc_3_check = false;
  439.                         }
  440.  
  441.                         // Nimmt die höchste Hochzahl und setzt den Checkwert auf false um doppelte Hochrechnung zu verhindern
  442.  
  443.                         double pow_power = Math.Pow(Convert.ToDouble(new_array.Substring(begin_index + 1, end_index - begin_index - 1)), pow); // Nimmt die Zahl in den Indexen und nimmt sie mit der gegebenen Hochzahl hoch
  444.  
  445.                         new_array = new_array.Remove(begin_index, end_index - begin_index + 1).Insert(begin_index, pow_power.ToString()); // Entfernt die Klammern und die Hochzahl, während das Ergebnis eingefügt wird
  446.  
  447.                         calc_array[i] = new_array; // Wird im Array gesichert
  448.                     }
  449.                 }
  450.             }
  451.  
  452.             string ergebnis_final = "";
  453.  
  454.             for (int i = 0; i < calc_array.Length; i++)
  455.             { // Das Ergebnis wird in einem String zusammengefügt
  456.                 ergebnis_final = ergebnis_final + calc_array[i];
  457.             }
  458.  
  459.             // I'm could not bring this **** to work properly! I will just use a workaround.
  460.             // BSP: 2 * -100 + 1 * -100 - 3
  461.  
  462.             /*string[] mult_calc_array = i_will_hail_to_my_coffee_if_this_will_work.Split('*');
  463.             string a = "", b = "";
  464.             string mul_a = "", mul_b = "", mul_c = "";
  465.             for (int i = 0; i < mult_calc_array.Length - 1; i++)
  466.             {
  467.                 int counter = 0, indexer = 0, counter_b = 0;
  468.  
  469.                 for (int j = mult_calc_array[i].Length - 1; j >= 0; j--)
  470.                 {
  471.                     //MessageBox.Show("fy");
  472.                     string lost_count_of_arrays_or_strings = mult_calc_array[i];
  473.  
  474.                     if (Char.IsDigit(lost_count_of_arrays_or_strings[j]))
  475.                     {
  476.                         counter++;
  477.                         indexer = j;
  478.                     }
  479.  
  480.                     try
  481.                     {
  482.                         if (lost_count_of_arrays_or_strings[indexer - 1] == '-' || lost_count_of_arrays_or_strings[indexer - 1] == '+')
  483.                         {
  484.                             counter++;
  485.                             break;
  486.                         }
  487.                     }
  488.                     catch { }
  489.                 }
  490.  
  491.                 int trying = (mult_calc_array[i].Length) - (counter );
  492.  
  493.                 a = mult_calc_array[i].Substring(trying, counter);
  494.  
  495.                 for (int j = 0; j < mult_calc_array[i + 1].Length; j++)
  496.                 {
  497.                     string lost_count_of_arrays_or_strings = mult_calc_array[i + 1];
  498.  
  499.                     if (lost_count_of_arrays_or_strings[j] == '-' && j == 0) counter_b++;
  500.  
  501.                     if (Char.IsDigit(lost_count_of_arrays_or_strings[j]))
  502.                     {
  503.                         counter_b++;
  504.                     }
  505.                 }
  506.  
  507.                 b = mult_calc_array[i + 1].Substring(0, counter_b - 1);
  508.  
  509.                 double c = Convert.ToDouble(a) * Convert.ToDouble(b);
  510.  
  511.                 if (i == 0) mul_a = c.ToString();
  512.                 if (i == 1) mul_b = c.ToString();
  513.                 if (i == 2) mul_c = c.ToString();
  514.             }
  515.  
  516.             MessageBox.Show(mul_a + ", " + mul_b + ", " + mul_c);
  517.             int count_for = 0, count_back = 0;
  518.  
  519.             for (int i = 0; i < i_will_hail_to_my_coffee_if_this_will_work.Length; i++)
  520.             {
  521.                 if (i_will_hail_to_my_coffee_if_this_will_work[i] == '*')
  522.                 {
  523.                     for (int j = 0; j < i_will_hail_to_my_coffee_if_this_will_work.Length; j++)
  524.                     {
  525.                         if (Char.IsDigit(i_will_hail_to_my_coffee_if_this_will_work[i - j]) )
  526.                         {
  527.                             count_back++;
  528.                         }
  529.  
  530.                         if (Char.IsDigit(i_will_hail_to_my_coffee_if_this_will_work[i + j]))
  531.                         {
  532.                             count_for++;
  533.                         }
  534.                     }
  535.                 }
  536.             }
  537.  
  538.             int index = i_will_hail_to_my_coffee_if_this_will_work.IndexOf('*');
  539.             int index_2 = i_will_hail_to_my_coffee_if_this_will_work.IndexOf('*', index);
  540.             int index_3 = i_will_hail_to_my_coffee_if_this_will_work.IndexOf('*', index_2);
  541.  
  542.             int begin_a = 0, end_a = 0, begin_b = 0, end_b = 0, begin_c = 0, end_c = 0;
  543.  
  544.             if(index != -1)
  545.             {
  546.                 for (int i = 0; i < i_will_hail_to_my_coffee_if_this_will_work.Length; i++)
  547.                 {
  548.                     if (Char.IsDigit(i_will_hail_to_my_coffee_if_this_will_work[index - i])) begin_a++;
  549.                     if (Char.IsDigit(i_will_hail_to_my_coffee_if_this_will_work[index + i]) && i_will_hail_to_my_coffee_if_this_will_work[index + i] == '-') end_a++;
  550.                 }
  551.             }*/
  552.  
  553.             var result = new DataTable().Compute(ergebnis_final, null); // Rechnet den Ergebnisstring durch
  554.  
  555.             // Funktioniert nicht 100%ig.
  556.  
  557.             return Convert.ToDouble(result); // Übergibt des Ergebnis
  558.         }
  559.     }
  560. }
Advertisement
Add Comment
Please, Sign In to add comment