如果不满足该值,我试图让我的代码重新打印一行。我试过使用,while但如果“X”不大于或等于 1,它不会回到问题。我目前正在尝试: import java.util.Scanner;public class rpg { public static void main(String[] args) { Scanner input = new Scanner(System.in); double hp = 10; System.out.println("how much damage do you wish to do?"); double attack = input.nextDouble(); double damage = hp - attack; System.out.println(damage); System.out.println("health = " + Math.round(hp)); while (hp <= 1) { System.out.println("Alive"); break; } } }但是当 hp 仍然大于 1 时,我无法重新说明问题。
添加回答
举报
0/150
提交
取消