Advertisement
Figureight

Estudo de Geometria Analitica

Aug 20th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.61 KB | None | 0 0
  1. using System;
  2. using System;
  3.  
  4. public class Program
  5. {
  6.     public static void Main()
  7.     {
  8.         //Entrada das coordenadas
  9.         Console.WriteLine("Digite as cordenadas X, Y");
  10.         Console.WriteLine("A");
  11.         int Ax = Convert.ToInt32(Console.ReadLine());
  12.         int Ay = Convert.ToInt32(Console.ReadLine());
  13.         Console.WriteLine("B");
  14.         int Bx = Convert.ToInt32(Console.ReadLine());
  15.         int By = Convert.ToInt32(Console.ReadLine());
  16.         Console.WriteLine("C");
  17.         int Cx = Convert.ToInt32(Console.ReadLine());
  18.         int Cy = Convert.ToInt32(Console.ReadLine());
  19.  
  20.         //Calculo a para saber o tamanho dos lados
  21.         //Lembrar de aplicar forma de passar tudo para positivo
  22.         //O operador ^ funciona como XOR
  23.         //https://www.tutorialspoint.com/csharp/csharp_operators.htm
  24.         double AB = Math.Sqrt(Math.Pow((Bx - Ax),2) + Math.Pow((By - Ay), 2));
  25.         double AC = Math.Sqrt(Math.Pow((Cx - Ax), 2) + Math.Pow((Cy - Ay), 2));
  26.         double BC = Math.Sqrt(Math.Pow((Cx - Bx), 2) + Math.Pow((Cy - By), 2));
  27.         double diagonal = (Ax * By * 1 + Ay * 1 * Cx + 1 * Bx * Cy) - (Ay * Bx * 1 + Ax * 1 * Cy + 1 * By * Cx);
  28.         //int primeiraDI =  Ax * By * 1 ;
  29.         //int segundaDI = Ay * 1 * Cx;
  30.         //int terceiraDI =  1 * Bx * Cy;
  31.         double area = diagonal * 0.5f;
  32.         double perimetro = (AB + AC + BC);
  33.  
  34.         Console.WriteLine("Area ps: se estiver negativo entenda como positivo" + area);
  35.         Console.WriteLine(perimetro);
  36.         Console.WriteLine("APERTE QUALQUER TECLA PARA ENCERRAR:");
  37.         Console.Read();
  38.  
  39.  
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement