面向对象的第一次pta作业第二题:判断坐标点所在范围
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner coor = new Scanner(System.in); double x,y; x=coor.nextDouble(); y=coor.nextDouble(); if(x<=5&&x>=-5&&y<=2.5&&y>=-2.5) System.out.println("In the rectangle"); else System.out.println("Not in the rectangle"); } }

这道题也挺简单的= =
虽然一开始总觉得题目怪怪的,依旧没有意识到Java和c的区别
浙公网安备 33010602011771号