static void Main(string[] args) { DataManager dm; SimpleTree st; List <double> dl = new List <double>(); try { dm = new DataManager(@"config.txt"); st = new SimpleTree(); // KAA: ineffizient foreach (int currentInt in dm.GetIntNumbers()) { st.Add(currentInt); } foreach (double currentDouble in dm.GetDoubleNumbers()) { dl.Add(currentDouble); } } catch (Exception ex) { Console.WriteLine(ex.Message); } // AVG des Baumes fehlt Console.WriteLine(dl.Average()); }
private void button_Click(object sender, RoutedEventArgs e) // Add Button { try { if (textBox.Text == "") { throw new Exception("Das Inputfeld ist leer!"); } tree.Add(double.Parse(textBox.Text)); tbUserMessage.Text += textBox.Text.ToString() + "\n"; textBox.Clear(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }