110,567
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using System.IO;
namespace ConsoleApplication1
{
public class Coordinate
{
int x;
public int X
{
get { return x; }
set { x = value; }
}
int y;
public int Y
{
get { return y; }
set { y = value; }
}
public Coordinate(int a, int b)
{
this.X = a;
this.Y = b;
}
public static void JiSuanDistance(Coordinate a,Coordinate b)
{
double m = (a.X - b.X) * (a.X - b.X) + (a.Y - b.Y) * (a.Y - b.Y);
Console.WriteLine("两点间距离为:"+System.Math.Sqrt(m));
}
}
class Program
{
static void Main(string[] args)
{
Coordinate r = new Coordinate(100,80);
Coordinate t = new Coordinate(90,70);
Coordinate.JiSuanDistance(r,t);
Console.Read();
}
}
}