static void Main(string[] args) { long a; do { Console.WriteLine("Введите число a:"); }while (!Int64.TryParse(Console.ReadLine(), out a)); long b; do { Console.WriteLine("Введите число b:"); }while (!Int64.TryParse(Console.ReadLine(), out b)); long time; Console.WriteLine(Evklid.Gcd(a, b, out time)); Console.WriteLine("Затраченное время на Gcd - " + time.ToString()); Console.WriteLine(Evklid.BinaryGcd(a, b, out time)); Console.WriteLine("Затраченное время на GcdBinary - " + time.ToString()); Console.WriteLine(Evklid.GcdMany(out time, 150586, 4548595, 90012522, 7525482, -5, 1055842554, 15025485)); Console.WriteLine("Затраченное время на GcdMany - " + time.ToString()); Console.ReadLine(); }
public void GcdMany_10and15and20and25and50and100_5() { //arrange var expected = 5L; var time = 0L; //act var actual = Evklid.GcdMany(out time, 10, 15, 20, 25, 50, 100); //assert Assert.AreEqual(expected, actual); Assert.AreEqual(0, time, 1); }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text.Length < 1 && textBox2.Text.Length < 1) { MessageBox.Show("Введите числа a и b"); } long timeGcd; long timeGcdBinary; long timeGcdMany; string[] data = richTextBox1.Text.Split(',').ToArray(); long[] datalong = data.Select(x => Int64.Parse(x)).ToArray(); textBox3.Text = Evklid.Gcd(Convert.ToInt64(textBox2.Text), Convert.ToInt64(textBox1.Text), out timeGcd).ToString(); textBox4.Text = Evklid.BinaryGcd(Convert.ToInt64(textBox2.Text), Convert.ToInt64(textBox1.Text), out timeGcdBinary).ToString(); textBox5.Text = Evklid.GcdMany(out timeGcdMany, datalong).ToString(); chart1.Series["Execution Time"].Points.AddXY("Gcd", timeGcd); chart1.Series["Execution Time"].Points.AddXY("GcdMany", timeGcdMany); chart1.Series["Execution Time"].Points.AddXY("GcdBinary", timeGcdBinary); }