我仍在處理我的Java鑽石問題。For循環未輸入
這是鑽石的當前狀態
我想這個問題是for
循環就在這裏, 所有我需要的是要打印的空間,然後我完了。
任何人都可以看到任何明顯的原因爲什麼for
循環我標記的問題沒有被輸入或運行?
//Bottom half of the diamond
int middleSpaces = sides + 2;
int downPreSpaces = 1;
int dRows = sides + 1;
for (int x = 1; x <= dRows; x++) {
if (x >= dRows) {
for (int z = 1; z <= sides + 1; z++) {
System.out.print(" ");
}
System.out.print("v");
}
if (x != dRows) {
for(int y = 1; y <= x; y++) {
System.out.print(" ");
}
System.out.print("\\");
//PROBLEM IS HERE
for (int e = middleSpaces - 2; e <= 0; e += 2) {
System.out.print(" ");
}
System.out.print("/\n");
}
後的初始值,middlespace.etc –
@boxed__l你去那裏,也是我剛剛與停車點搞亂對於循環,所以我知道這是不正確的現在,但如果你可以指向我的權利變量插入那將是真棒 – 23k