如果不滿足該值,我試圖讓我的代碼重新打印一行。我試過使用,while但如果“X”不大于或等于 1,它不會(huì)回到問題。我目前正在嘗試: 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; } } }但是當(dāng) hp 仍然大于 1 時(shí),我無法重新說明問題。
添加回答
舉報(bào)
0/150
提交
取消