我正在嘗試爲學校項目製作RPG。遊戲結束,當你擊敗老闆。你可以訓練和挑戰老闆之前隨機怪物。我現在面臨的問題是,戰鬥方法中的循環不會停止。 import java.util.Scanner;
import java.util.Random;
public class A{
public static void main(String []args){
Scanner get = n
x=0
y=0
while 1==1:
while y!=5:
y=y+1
print(str(x) + str(y))
else:
x=x+1
#NOW GO TO WHILE 1==1 AND DO THAT AGAIN
此代碼應該打印01; 02; 03; 04; 05然後它應該打印11; 12; 13; 1
我在Python 3.6.0上編寫了下面的代碼來找到Spyder編輯器上的立方體根。 #Finding the cube root
#import math
y=input("Enter a number whose cube root you want to find: ")
root=float(y)
#x1=math.pow(root,1/3)
我試圖在getCommand函數中使用while(1)循環,但它運行無限且不會中斷。我已經包含了HELP函數,因爲它在getCommand函數中被調用。這是有問題的代碼: void HELP(string inCommand) {
if (inCommand == "invLoad?")
cout << "This command allows the user to loa
我正在寫一個簡單的bash腳本來從文本文件中讀取文件名並檢查它們是否存在於目錄中。雖然這工作正常,所有文件解析後,我陷入了無限循環。 #!/bin/bash
if [ "$1" = "" ]; then
echo "No input file to parse given. Give me an input file and make sure the corresponding .