{ Scanner scan = new Scanner(System.in); Point point1 = new Point(); Point point2 = new Point(); double x, y; point1.setLocation(5.0, 5.0); point2.setLocation(1.0, 1.0); System.out.println("请分别输入点x,y的坐标:"); x = scan.nextDouble(); y = scan.nextDouble(); boolean pdline = (x - point1.getX()) * (point1.getY() - point2.getY()) == (point1.getX() - point2.getX()) * (y - point1.getY()); if (pdline) { System.out.println("您输入的点在该条直线上"); } else { System.out.println("您输入的点不在该条直线上"); } scan.close(); }

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-31
猜你喜欢
  • 2021-08-18
  • 2022-12-23
  • 2022-12-23
  • 2023-01-27
  • 2021-11-19
  • 2021-12-05
相关资源
相似解决方案