Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class PointInCircle
- {
- static void Main()
- {
- double x = 0;
- double y = 0;
- double radius = 2;
- double[] arrayX = { 0, -2, -1, 1.5, -1.5, 100, 0, 0.2, 0.9, 1 };
- double[] arrayY = { 1, 0, 2, -1, -1.5, -30, 0, -0.8, -1.93, 1.655 };
- string tab = new string('\t', 1);
- string table = new string('-', 45);
- Console.WriteLine("inSide" + tab + tab + "X" + tab + "Y" + tab + "Vector Length \r\n" + table);
- int count = 0;
- while (count < arrayX.Length)
- {
- double vector = Math.Sqrt((Math.Pow(x - (arrayX[count]), 2)) + (Math.Pow(y - (arrayY[count]), 2)));
- if (vector > radius)
- {
- Console.WriteLine(false + tab + tab + "{0}" + tab + "{1}" + tab + "{2:0.###}", arrayX[count], arrayY[count], vector);
- }
- else if (vector <= radius)
- {
- Console.WriteLine(true + tab + tab + "{0}" + tab + "{1}" + tab + "{2:0.###}", arrayX[count], arrayY[count], vector);
- }
- count++;
- }
- Console.WriteLine(table);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement