private void DoCompare(object sender, RoutedEventArgs e) { try { TimeSpan timeE; TimeSpan timeS; GCD.Euclidean(out timeE, Convert.ToInt64(OneE.Text), Convert.ToInt64(TwoE.Text)); GCD.BinaryEuclidean(out timeS, Convert.ToInt64(OneS.Text), Convert.ToInt64(TwoS.Text)); string elapsedTimeE = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", timeE.Hours, timeE.Minutes, timeE.Seconds, timeE.Milliseconds / 10); string elapsedTimeS = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", timeS.Hours, timeS.Minutes, timeS.Seconds, timeS.Milliseconds / 10); ResultEuclidean.Text = $"Алгоритм Евклида " + elapsedTimeE; ResultStein.Text = $"Алгоритм Стейна " + elapsedTimeS; } catch { MessageBox.Show("Заполните поля правильно!"); } }
private void DoB(object sender, RoutedEventArgs e) { TimeSpan time; long result = 0; try { result = GCD.BinaryEuclidean(out time, Convert.ToInt64(oneB.Text), Convert.ToInt64(twoB.Text)); string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", time.Hours, time.Minutes, time.Seconds, time.Milliseconds); if (result != 0) { MessageBox.Show($"НОД чисел является число {result}. Время выполнения: {elapsedTime}"); } } catch { MessageBox.Show("Заполните поля правильно!"); } }