求两点间的距离
import java.util.Scanner;
class Point{
double x;
double y;
}
public class Test01 {
public static void main(String[] args){
Point a=new Point();
Point b=new Point();
Scanner scanner=new Scanner(System.in);
a.x=scanner.nextDouble();
a.y=scanner.nextDouble();
b.x=scanner.nextDouble();
b.y=scanner.nextDouble();
System.out.println("结果是:");
System.out.printf("%.4f",Math.pow(Math.pow(a.x-b.x,2)+Math.pow(a.y-b.y,2),0.5));
}
}
本文来自博客园,作者:{李浩正},转载请注明原文链接:https://www.cnblogs.com/hzzzz/p/16098166.html