VB中有一个可以画出菱形的代码是这样写的
PrivateSubForm_Click()Fori=1To5Forj=6-iTo1Print""NextjForj=1To2*i-1Print"*";NextjPrin...
Private Sub Form_Click()
For i = 1 To 5
For j = 6 - i To 1
Print ""
Next j
For j = 1 To 2 * i - 1
Print "*";
Next j
Print
Next i
For i = 1 To 4
For j = 1 To i + 1
Print "";
Next j
For j = 1 To 9 - 2 * i
Print "*";
Next j
Print
Next i
End Sub
1‘这个运行以后只是菱形的右边一半
2’在nextj后为什么又要写print
3'print“”;输出空格为什么引号后面还要加一个分号 展开
For i = 1 To 5
For j = 6 - i To 1
Print ""
Next j
For j = 1 To 2 * i - 1
Print "*";
Next j
Next i
For i = 1 To 4
For j = 1 To i + 1
Print "";
Next j
For j = 1 To 9 - 2 * i
Print "*";
Next j
Next i
End Sub
1‘这个运行以后只是菱形的右边一半
2’在nextj后为什么又要写print
3'print“”;输出空格为什么引号后面还要加一个分号 展开
1个回答
展开全部
Private Sub Form_Click()
For i = 1 To 5
For j = 6 - i To 1 Step -1
Print " ";
Next j
For j = 1 To 2 * i - 1
Print "*";
Next j
Print
Next i
For i = 1 To 4
For j = 1 To i + 1
Print " ";
Next j
For j = 1 To 9 - 2 * i
Print "*";
Next j
Print
Next i
End Sub
next j后为什么又要写print,是为了回车
print " ";输出空格为什么引号后面还要加一个分号,是为了不回车,后面的输出继续接在空格后面
For i = 1 To 5
For j = 6 - i To 1 Step -1
Print " ";
Next j
For j = 1 To 2 * i - 1
Print "*";
Next j
Next i
For i = 1 To 4
For j = 1 To i + 1
Print " ";
Next j
For j = 1 To 9 - 2 * i
Print "*";
Next j
Next i
End Sub
next j后为什么又要写print,是为了回车
print " ";输出空格为什么引号后面还要加一个分号,是为了不回车,后面的输出继续接在空格后面
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询