Exemplo n.º 1
0
 public static void Sqrt_Negative()
 {
     try
     {
         MyBranching.Sqrt(-1);
     }
     catch
     {
         Assert.Pass();
     }
     Assert.Fail();
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Введите три числа");
            double a = Convert.ToInt32(Console.ReadLine());
            double b = Convert.ToInt32(Console.ReadLine());
            double c = Convert.ToInt32(Console.ReadLine());

            if (a == 0 || a == 1 || b == 0 || c == 0)
            {
                Console.WriteLine("Это не полное квадратное уравнение, я не такая программа");
                return;
            }
            if (b * b - 4 * a * c < 0)
            {
                Console.WriteLine("Корней нет");
                return;
            }

            Console.WriteLine((-b + MyBranching.Sqrt(b * b - 4 * a * c)) / (2 * a));
            Console.WriteLine((-b - MyBranching.Sqrt(b * b - 4 * a * c)) / (2 * a));
            return;
        }
Exemplo n.º 3
0
        public static void Sqrt_Positive(double a, double expected)
        {
            double actual = MyBranching.Sqrt(a);

            Assert.AreEqual(expected, actual, 0.00000001);
        }