This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center。
7年前关闭。
那是我的代码。如果输入100001,它将跳过循环,但是如果输入100000,则不会。为什么是这样?
手段
因此,当您放置
7年前关闭。
do {
System.out.println("Please enter the cost: ");
Cost1 = input.nextDouble();
} while (Cost1 <= 100000 || Cost1 >= 900000);
那是我的代码。如果输入100001,它将跳过循环,但是如果输入100000,则不会。为什么是这样?
最佳答案
条件错误(根据您的期望)
Cost1 <= 100000 || Cost1 >= 900000
手段
While Cost1 <= 100k OR Cost1 >=900K
因此,当您放置
100001
时,其不小于等于100k
也不大于等于900K
07-24 15:49