Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConditionalStatementsAdvanced
- {
- class Program
- {
- static void Main(string[] args)
- {
- //x1, y1, x2, y2, x и y
- double x1 = double.Parse(Console.ReadLine());
- double y1 = double.Parse(Console.ReadLine());
- double x2 = double.Parse(Console.ReadLine());
- double y2 = double.Parse(Console.ReadLine());
- double x = double.Parse(Console.ReadLine());
- double y = double.Parse(Console.ReadLine());
- //Border -> 1 точка или 2 точка
- //1 точка -> x съвпада с x1 или x2 -> x == x1 || x == x2
- //и
- //y е между y1 и y2 -> y >= y1 && y <= y2
- //2 точка -> y съвпада с y1 или y2 -> y == y1 || y == y2
- //и
- //същевременно x е между x1 и x2 -> x >= x1 && x <= x2
- bool condition1 = (x == x1 || x == x2) && (y >= y1 && y <= y2);
- bool condition2 = (y == y1 || y == y2) && (x >= x1 && x <= x2);
- if(condition1 || condition2)
- {
- Console.WriteLine("Border");
- }
- else
- {
- Console.WriteLine("Inside / Outside");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement