import java.lang.Math;
public class LogicTableGenerator
{
public static void main(String[] args)
{
double numletters;
System.out.println("how many letters exist in your logic table?");
numletters=TextIO.getInt(); double totalpremises;
totalpremises=Math.pow(2.0,numletters);
System.out.println("what letters are you using?");
char letter; letter = 'A'; char letter1, letter2, letter3, letter4,letter5,letter6,letter7,letter8,letter9;
int numstop; numstop =0;
System.out.println(numstop);
boolean bag;
bag=(1!=1);
System.out.println(bag);
while (!(numstop == 1))
{
letter1=TextIO.getChar();
System.out.println("Do you awant to stop? Press 1 for Yes, otherwise press a different number.");
numstop=TextIO.getInt();
System.out.println(numstop);
letter2=TextIO.getChar();
System.out.println(numstop);
System.out.println("Do you want to stop? Press 1 for Yes, otherwise press a different number.");
numstop=TextIO.getInt();
letter3=TextIO.getChar();
System.out.println("Do you want to stop? Press 1 for Yes, otherwise press a different number.");
numstop=TextIO.getInt();
letter4=TextIO.getChar();
System.out.println("Do you want to stop? Press 1 for Yes, otherwise press a different number.");
numstop=TextIO.getInt();
letter5=TextIO.getChar();
System.out.println("Do you want to stop? Press 1 for Yes, otherwise press a different number.");
numstop=TextIO.getInt();
letter6=TextIO.getChar();
System.out.println("Do you want to stop? Press 1 for Yes, otherwise press a different number.");
numstop=TextIO.getInt();
letter7=TextIO.getChar();
System.out.println("Do you want to stop? Press 1 for Yes, otherwise press a different number.");
numstop=TextIO.getInt();
letter8=TextIO.getChar();
System.out.println("Do you want to stop? Press 1 for Yes, otherwise press a different number.");
numstop=TextIO.getInt();
letter9=TextIO.getChar();
System.out.println("You have reached the end of the road. You are now done.");
}
}
}
我不理解這是爲什麼不停止,一旦numstop等於1不應循環結束匹配?While循環不會在Java終止即使數值情況下,布爾值
堆棧溢出是讓我發佈更多細節,實在是沒有什麼後請不要讀這個,因爲它只是包含了一堆話,如果你還在讀書,請現在停止閱讀
請閱讀[問]並嘗試製作[mcve]。你的問題缺少一個明確的問題陳述。此外,請格式化您的代碼... – Tunaki
什麼是'TextIO'? – brso05
根據代碼循環將繼續運行,直到numstop不變爲1.您的while可以被重寫爲while(numstop!= 1)。你確定你正在碰到這種情況嗎? – user3509208