Показать сообщение отдельно

  #8  
Старый 30.05.2010, 18:24
Korotnoe
Новичок
Регистрация: 28.06.2009
Сообщений: 17
Провел на форуме:
270620

Репутация: 12
По умолчанию

В чём проблемма???? Пишет что переменные A B C равны NaN
С#
Код:
using System;
using System.Collections.Generic;
using System.Text;

namespace IF3
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Введите координаты точки А");
            double x1 = double.Parse(Console.ReadLine());
            double y1 = double.Parse(Console.ReadLine());

            Console.WriteLine("Введите координаты точки B");
            double x2 = double.Parse(Console.ReadLine());
            double y2 = double.Parse(Console.ReadLine());

            Console.WriteLine("Введите координаты точки C");
            double x3 = double.Parse(Console.ReadLine());
            double y3 = double.Parse(Console.ReadLine());

            double a, b, c;
            a = Math.Sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
            b = Math.Sqrt((x3 - x2) * (x3 - x2) + (y3 - y2) * (y3 - y2));
            c = Math.Sqrt((x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1));
            double A, B, C;

            A = Math.Acos(Math.Abs((b * b) + (c * c) - (2 * b * c) - (a * a)));
            B = Math.Acos(Math.Abs((a * a) + (c * c) - (2 * a * c) - (b * b)));
            C = Math.Acos(Math.Abs((a * a) + ( b* b) - (2 * a * b) - (c * c)));
            if (A == 90 || B == 90 || C == 90)
                Console.WriteLine("Прямоугольный(pr)");
            else if (A > 90 || B > 90 || C > 90)
                Console.WriteLine("Тупоугольный(tup)");
            else Console.WriteLine("Остроугольный(ostr)");
            Console.ReadLine();




        }
    }
}

Последний раз редактировалось Korotnoe; 30.05.2010 в 18:27..
 
Ответить с цитированием