VB作业,用FOR循环打印图案
2个回答
展开全部
Sub Form1_Click()
Dim i As Integer, m As Integer, n As Integer
Dim Strm As String, Strn As String
For i = 1 To 6
Strm = ""
For m = 1 To i
Strn = ""
For n = 1 To m
Strn = Strn & n
Next
If i Mod 2 = 1 Then
Strm = Strm & " " & Strn & " "
Else
Strm = Strm & (-1) * Strn & " "
End If
Next
Print Strm
Next
End Sub
追问
strn 是什么意思?
追答
strm和strn仅仅是两个字符串型变量而已!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询