嗨,我做我的課程和我一直在考慮的任務是使算法的方形這是使用5×5「*」,但必須結合填寫「」。所以這樣的:Outputing方在Java安慰
*****
*...*
*...*
*...*
*****
我已經使用此代碼,我知道它可能非常混亂,因爲我是一個絕對的初學者這個東西。我似乎無法得到「。」在我目前有:
*****
*****
*****
*****
*****
這裏是我的代碼:
public static void main(String args[])
{
System.out.print ("#size of square");
int stars=BIO.getInt();
int j=1;
while(j <= stars)
{
int starsNumber=1;
while (starsNumber<= stars)
{
int i = 1; // Display trunk
starsNumber=starsNumber+1;
System.out.print('*');
}
System.out.println();
j= j +1;
}
}
PS對不起,在編碼那麼糟糕:d和任何幫助,將不勝感激感謝加雷思
您目前沒有可以打印「。」的代碼 – harold
輸出的結果是什麼樣的? – blank
強烈建議您針對您的問題使用更具描述性的標題,例如「輸出一個正方形」 –