コード例 #1
0
ファイル: Classes.cs プロジェクト: shaemorlis/ISTA220
        public double DistanceTo(Shotgun other)
        {
            int    xDiff    = this.x - other.x;
            int    yDiff    = this.y - other.y;
            double distance = Math.Sqrt((xDiff * xDiff) + (yDiff * yDiff));

            return(distance);
        }
コード例 #2
0
        static void doWork()
        {
            Shotgun origin      = new Shotgun();
            Shotgun bottomRight = new Shotgun(1366, 768);
            double  distance    = origin.DistanceTo(bottomRight);

            Console.WriteLine($"Distance is: {distance}");
            Console.WriteLine($"Number of Point objects: {Shotgun.ObjectCount()}");
        }