使用循环语句编程序在窗体中打印如下图形: ** **** ****** ******** VB编程,急!

2024-12-22 17:50:10
推荐回答(5个)
回答1:

Private Sub Form_Click()
Dim i As Integer
Dim j As Integer
Print vbCrLf
For i = 1 To 4
Print Tab(8 - i);
For j = 1 To 2 * i
Print "*";
Next j
Print
Next i
For i = 1 To 4
Print Tab(8 - i);
For j = 1 To 2 * i
Print "*";
Next j
Print
Next i
For i = 1 To 4
Print " ** "
Next
End Sub

是一颗树哈,完整的代码

回答2:

大概就是这个思路:第一行3个空格,2个*,第二行2个空格4个*,第三行 1个空格6个* 滴行 无空格8个*
自定义 j=4
循环 for i=1 to 4 (循环4次,也就是4行)
打印 j-i 个 “ ”;(依次打印空格数)
在打印 i*2个 “*”(在打印*的数量)
next i (循环)
end
呵呵,我大概知道的意思,也就是这样,具体vb的打印和循环功能你应该知道。

回答3:

直线是一条一条依次出现,布满窗体..程序要用到IF语句和FOR NEXT循环语句, Set Line1 = Controls.Add(

回答4:

Private Sub Command1_Click()

Dim i As Integer, n As Integer
n = 4
For i = 1 To n
Print Space(n - i); String(2 * i, "*")
Next

End Sub

回答5:

Private Sub Form_Click()
For i = 1 To 4
Print Tab(8 - i);
For j = 1 To 2 * i
Print "*";
Next j
Print
Next i
End Sub