說我想要做一些「塔」是這個樣子:乘法字符串
*********
*********
********* *******
********* *******
********* ******* ***************
********* ******* ***************
********* ******* ***************
********* ******* ***************
********* ******* ***************
********* ******* ***************
********* ******* ***************
如果我要求用戶輸入三個不同的號碼爲塔的寬度和隨機整數將彌補長度,我怎麼能做一個循環,乘以「*」乘以用戶輸入的寬度數?這是我到目前爲止:
for(int i = 0; i < randInt1; i++){
// I would like to do something like
// System.out.print("*") * width1
// and do this for all three towers so that they
// print next to each other separated by a space
}
爲了讓回答者或其他有類似問題的人更容易,請編輯添加一個特定的問題陳述 - 「不起作用」可以假定,但* how *不起作用?什麼錯誤信息或不正確的行爲是特徵? –
「長度」是什麼意思?它是每列的「高度」嗎? –
@BingLu是這意味着高度。 – joanne72205