一、Private Sub Form_Click()
show
Dim m, n, i, j As Integer
m = 4 :n = 7
For i = 1 To m
For j = 1 To m - i + 1
Print " ";
Next j
For j = 1 To n
Print "*";
Next j
Next i
For i = 1 To m
For j = 1 To m - i + 1
Print " ";
Next j
For j = 1 To 2 * i - 1
Print "*";
Next j
Next i
For i = 1 To m
For j = 1 To i
Print " ";
Next j
For j = 1 To 2 * m - 2 * i + 1
Print "*";
Next j
Next i
End Sub
二、Sub Command1_Click()
Dim i As Integer
For i = 1 To 11 Step 2
For m = 11 To i Step -1
Debug.Print "*";
Next
Print Chr(10) & Space(1 + i \ 2);
Next
End Sub
扩展资料:
在VB中,注释有2种方式。
1、以Rem关键字开头,并且Rem关键字与注释内容之间要加一个空格。注释可以是单独的一行,也可以写在其他语句行的后面。如果在其他语句行后使用Rem关键字,则必须使用冒号(:)与语句隔开。
2、使用一个撇号(')来代替Rem关键字。若使用撇号,则在其他语句行使用时不必加冒号。
特征衡量
在 Visual Basic 中,可通过属性、方法和事件来说明和衡量一个对象的特征。
参考资料来源:百度百科-Visual Basic
VB里用星号输出平行四边形、正三角、倒三角的程序语句?
一、Private Sub Form_Click()show Dim m, n, i, j As Integer m = 4 :n = 7 For i = 1 To m For j = 1 To m - i + 1 Print " ";Next j For j = 1 To n Print "*";Next j Print Next i Print For i = 1 To m For j = 1 To m - i + 1 Print " ";N...
怎样在vb中用*打出平行四边形?
Dim s As String Dim n As Integer, m As Integer m = Val(InputBox("平行四边型的长度(即*的个数)")) ‘如果是常数值自己更改为常数即可 n = Val(InputBox("平等四边型的高度(即*的行数)"))s = String(n, "*")Me.AutoRedraw = True For i = 0 To m Print String(m -...
vb怎样打出“*”号倒三角形来?
可以参考下面的代码:Private Sub Command1_Click()Dim i As Long, j As Long Dim strTemp As String, strXing As String For i = 0 To 3 strXing = ""For j = 1 To (7 - Abs(i) * 2)strXing = strXing & "*"Next strTemp = Space(Abs(i)) & strXing & Space(Abs(i))Pr...
vb用*号 打印输出图形
Dim strOutput As String intRowNumber = 5 '画菱形部分 For i = 1 To intRowNumber If i < intRowNumber \/ 2 Then For j = 1 To intRowNumber - i - 2 strOutput = strOutput + " " 'msgbox里一个星号的宽度是两个空格宽度,所以这里加两个空格,如果用别的方法输出看情况修改...
vb:如何在文本框中用星号打印等腰三角形???
Dim i As Integer Dim j As Integer For i = 1 To 10 Text1.Text = Text1.Text & Space(12 - i) '关键在于这一句 For j = 1 To i Text1.Text = Text1.Text & "*"Next j Text1.Text = Text1.Text & Chr(13) + Chr(10) 'vbCrLf Next i ...
vb使用星号输出一个五行的直角三角形
For i = 1 To 5 Print String(i, "*")Next i
vb中输出两个上下颠倒的星号三角形
Private Sub Command1_Click()For i = 1 To 8 For j = 1 To 9 - i Print " ";Next j For j = 1 To 2 * i - 1 Print "*";Next j For j = 1 To 10 Print " ";Next j For j = 1 To 2 * (9 - i) - 1 Print "*";Next j Print Next i Print End Sub ...
怎么用vb编一个由星号组成的等腰三角形 要求第一行一个星号 第二行两...
Dim n As Integer n = 10 For i = 1 To n For k = 1 To n - i Print Chr(32);Next For j = 1 To i Print "*" & Chr(32);Next Print ""Next 放到Form_Paint()里面都可以。
怎样vb代码编写一个用星号组成的五角星
Else Debug.Print " "; End If Next Debug.Print Next For i = 7 To 18 For j = 0 To 40 If (j - x5 >= (x2 - x5) * (i - y5) \/ (y2 - y5) And j - x5 <= (x1 - x5) * (i - y5) \/ (y1 - y5)) Or (j - x4 >= (x1 - ...
怎么用VB星号输出这个形状???、 *** *** *** *** ** *
觉得String(i,"*")不习惯,可以用常规的 For i = 1 To 6 '行数 For j = 1 To 7 - i '列数,随着i变大j变小 Print "*";Next j Print '换行 Next i