Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System;
- public class Program
- {
- public static void Main()
- {
- //Entrada das coordenadas
- Console.WriteLine("Digite as cordenadas X, Y");
- Console.WriteLine("A");
- int Ax = Convert.ToInt32(Console.ReadLine());
- int Ay = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("B");
- int Bx = Convert.ToInt32(Console.ReadLine());
- int By = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("C");
- int Cx = Convert.ToInt32(Console.ReadLine());
- int Cy = Convert.ToInt32(Console.ReadLine());
- //Calculo a para saber o tamanho dos lados
- //Lembrar de aplicar forma de passar tudo para positivo
- //O operador ^ funciona como XOR
- //https://www.tutorialspoint.com/csharp/csharp_operators.htm
- double AB = Math.Sqrt(Math.Pow((Bx - Ax),2) + Math.Pow((By - Ay), 2));
- double AC = Math.Sqrt(Math.Pow((Cx - Ax), 2) + Math.Pow((Cy - Ay), 2));
- double BC = Math.Sqrt(Math.Pow((Cx - Bx), 2) + Math.Pow((Cy - By), 2));
- double diagonal = (Ax * By * 1 + Ay * 1 * Cx + 1 * Bx * Cy) - (Ay * Bx * 1 + Ax * 1 * Cy + 1 * By * Cx);
- //int primeiraDI = Ax * By * 1 ;
- //int segundaDI = Ay * 1 * Cx;
- //int terceiraDI = 1 * Bx * Cy;
- double area = diagonal * 0.5f;
- double perimetro = (AB + AC + BC);
- Console.WriteLine("Area ps: se estiver negativo entenda como positivo" + area);
- Console.WriteLine(perimetro);
- Console.WriteLine("APERTE QUALQUER TECLA PARA ENCERRAR:");
- Console.Read();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement