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.Text;
- using System.Threading.Tasks;
- namespace _09.Longer_Line
- {
- class Program
- {
- static void Main(string[] args)
- {
- var x1 = double.Parse(Console.ReadLine());
- var y1 = double.Parse(Console.ReadLine());
- var x2 = double.Parse(Console.ReadLine());
- var y2 = double.Parse(Console.ReadLine());
- var x3 = double.Parse(Console.ReadLine());
- var y3 = double.Parse(Console.ReadLine());
- var x4 = double.Parse(Console.ReadLine());
- var y4 = double.Parse(Console.ReadLine());
- var cordinate1 = Cordinates(x1, y1,x2,y2);
- var cordinate2 = Cordinates(x3, y3,x4,y4);
- if (cordinate1>cordinate2)
- {
- var cord1 = Close(x1, y1);
- var cord2 = Close(x2, y2);
- if (cord1<cord2)
- Console.WriteLine($"({x1}, {y1})({x2}, {y2})");
- else if (cord2>cord1)
- Console.WriteLine($"({x2}, {y2})({x1}, {y1})");
- }
- else if (cordinate1 <cordinate2)
- {
- var cord3 = Close(x3, y3);
- var cord4 = Close(x4, y4);
- if (cord3 < cord4)
- Console.WriteLine($"({x3}, {y3})({x4}, {y4})");
- else if (cord4 < cord3)
- Console.WriteLine($"({x4}, {y4})({x3}, {y3})");
- }
- else if (cordinate1 ==cordinate2)
- {
- Console.WriteLine($"({x1}, {y1})({x2}, {y2})");
- }
- }
- static double Cordinates(double x1, double y1, double x2, double y2)
- {
- double lineLength = Math.Sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
- return lineLength;
- }
- static double Close(double x, double y)
- {
- double distance = Math.Sqrt(Math.Pow(x, 2) +
- Math.Pow(y, 2));
- return distance;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement