2.15

import java.util.Scanner; public class Demo_1{ public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("输入 x1 和y1: "); System.out.print("输入 x2 和 y2: "); double b=input.nextDouble(); double d=input.nextDouble(); double a=input.nextDouble(); double c=input.nextDouble(); double y= (b-a)*(b-a)+(d-c)*(d-c); double distance = Math.pow(y, 0.5); System.out.print("The distance the two points is " + distance); } }
原文地址:https://www.cnblogs.com/jingjing1314/p/7542474.html