Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using Microsoft.AspNetCore.Hosting;
- using Microsoft.Extensions.Configuration;
- using Microsoft.Extensions.Hosting;
- using Microsoft.Extensions.Logging;
- namespace ffff
- {
- public class Program
- {
- public static double LongestLength(Line[] lines)
- {
- double longest = 0.0;
- for (int i = 0; i < lines.Length; i++)
- {
- if (lines[i].LineLength() > longest)
- {
- longest = lines[i].LineLength();
- }
- }
- return longest;
- }
- public static int CountLines(Point point, Line[]lines){
- for (int i = 0; i < lines. Length; i++) {
- if(lines[i].GetP1() == point || lines[i].GetP2() == point){
- Console.WriteLine(lines[i]);
- }
- }
- }
- public static void Main(string[] args)
- {
- Line[] lines = new Line[10];
- int maxL = 0;
- for (int i = 0; i < lines.Length; i++)
- {
- LongestLength(lines[i]);
- }
- }
- }
- class Point
- {
- private int x;
- private int y;
- public Point(int x , int y)
- {
- this.x = x;
- this.y = y;
- }
- public int GetX()
- {
- return x;
- }
- public void SetX(int x)
- {
- this.x = x;
- }
- public int GetY()
- {
- return y;
- }
- public void SetY(int y)
- {
- this.y = y;
- }
- }
- //: //////////////////////////////////////////
- class Line
- {
- private Point p1;
- private Point p2;
- public Line(Point p1, Point p2)
- {
- this.p1 = p1;
- this.p2 = p2;
- }
- public Point GetP1()
- {
- return p1;
- }
- public void SetP1(Point p1)
- {
- this.p1 = p1;
- }
- public Point GetP2()
- {
- return p2;
- }
- public void SetP2(Point p2)
- {
- this.p2 = p2;
- }
- public double LineLength()
- // טענת כניסה : הפעולה מקבלת שתי נקודות מטיפוס נקודה.
- // טענת יציאה : הפעולה מחזירה את אורך הקו.
- {
- double length = Math.Sqrt((this.p2.GetX() - p2.GetX()) * (p2.GetX() - p2.GetX()) + (p2.GetY() - p2.GetY()) * (p2.GetY() - p2.GetY()));
- return length;
- }
- public static bool IfMakbil(Point p1 , Point p2)
- {
- if(p1.GetY() == p2.GetY())
- {
- return true;
- }
- return false;
- }
- }
- //: ///////////////////////////////////////
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement