-1
//Question4
correct = false;
System.out.println("how many feet are in a yard?");
while (!correct)
{
x1 = input.nextInt();
if (x1==3)
{
System.out.println("correct.");
correct = true;
}
else
{
System.out.println("incorrect. try again.");
}
}
//Question5
correct = false;
System.out.println("What gets wetter and wetter the more it dries?");
while (correct == false)
{
s1 = input.nextLine();
if (s1.equalsIgnoreCase("a towel")) // cheating is bad!
{
System.out.println("correct");
correct = true;
}
else
{
System.out.println("incorrect. try again.");
}
}
輸出 多少腳是在一個院子裏? 正確。 乾燥得越多,它越溼潤越溼潤? 不正確。再試一次。甚至在詢問用戶輸入之前打印。正在打印此輸出爲什麼,顯得格格不入
Java'=/='JavaScript – VisioN 2013-03-06 23:39:55