求两点间的距离
作者:互联网
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)); } }
标签:scanner,Point,pow,System,距离,Math,两点,nextDouble 来源: https://www.cnblogs.com/hzzzz/p/16098166.html