Advertisement
Guest User

Untitled

a guest
Apr 7th, 2020
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.24 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace KirillLesson2
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             Point p1 = new Point();
  13.             p1.X = 0;
  14.             p1.Y = 0;
  15.  
  16.  
  17.             Point p2 = new Point();
  18.             p1.X = 2;
  19.             p1.Y = 2;
  20.  
  21.             Rectangle rectangle = new Rectangle();
  22.             rectangle.p1 = p1;
  23.             rectangle.p2 = p2;
  24.  
  25.             Console.WriteLine(rectangle.Square());
  26.         }
  27.     }
  28.  
  29.     class Rectangle
  30.     {
  31.         public Point p1;
  32.         public Point p2;
  33.  
  34.         public int Square()
  35.         {
  36.             return Math.Abs((p1.X - p2.X) * (p1.Y - p2.Y));
  37.         }
  38.  
  39.         public bool Intersects(Rectangle other)
  40.         {
  41.             // проперка пересечения
  42.             // TODO
  43.             //
  44.             return false;
  45.         }
  46.  
  47.         public bool Contains(Rectangle other)
  48.         {
  49.             // содержит ли
  50.             // TODO
  51.             //
  52.             return false;
  53.         }
  54.  
  55.         // Периметр
  56.         // TODO
  57.         //
  58.     }
  59.  
  60.     class Point
  61.     {
  62.         public int X;
  63.         public int Y;
  64.     }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement