bacco

Точка върху страната на правоъгълник

Jan 23rd, 2018
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.97 KB | None | 0 0
  1. using System;
  2.  
  3. namespace tESt
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.  
  10.             double x1 = double.Parse(Console.ReadLine());
  11.             double y1 = double.Parse(Console.ReadLine());
  12.             double x2 = double.Parse(Console.ReadLine());
  13.             double y2 = double.Parse(Console.ReadLine());
  14.             double x = double.Parse(Console.ReadLine());
  15.             double y = double.Parse(Console.ReadLine());
  16.  
  17.  
  18.             var righSide = (x == x2) && y <= y2 && y >= y1;
  19.             var leftSide = (x == x1) && y <= y2 && y >= y1;
  20.             var upSide = (y == y1) && x >= x1 && x <= x2;
  21.             var downSide = (y == y2) && x >= x1 && x <= x2;
  22.  
  23.             if (righSide || leftSide || upSide || downSide)
  24.                 {
  25.                 Console.WriteLine("Border");
  26.                 }
  27.             else
  28.             {
  29.                 Console.WriteLine("Inside / Outside");
  30.             }
  31.            
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment