level 3
下面的是我写出来的程序
Private Sub Form_Click()
Dim str As String
For i = 1 To 9
For j = 1 To i * 2 - 1
str = i & str
Next j
Print str
str = ""
Next i
End Sub
但是我想要打出这样的效果
1
222
33333
4444444
555555555
6666666
77777
888
9
空格不会放到前面,还有就是为什么不能在For…Next语句里面插入If…Then语句
大神求教怎么改啊
2017年04月06日 14点04分
1
level 3
数字前面也有空格,看上去像是两个金字塔底对底扣在一起
2017年04月06日 14点04分
3
level 15
经测试,似乎这样可以实现.
Dim i As Integer
Dim j As Integer
Dim str As String
Dim pMax As Integer
For i = 1 To 9
If i < 6 Then
pMax = 2 * (i - 1) + 1
Else
pMax = 9 - 2 * (i - 5)
End If
For j = 1 To pMax
str = i & str
Next j
Print str
str = ""
Next i
2017年04月06日 23点04分
7
感谢大神求教!!
2017年04月07日 01点04分
level 6
Private Sub Form_Click()
Dim str(0 to 9) As String
dim car
For i = 1 To 9
if i <=5 rhen
For j = 1 To i * 2 - 1
str(i)=str(i) & i
Next j
and if
if i >5 then
for j = 1 to (10-i)*2-1
str(i)=str(i) & i
next j
and if
car = car & str(i) & vbcf
Next i
print car
End Sub
1
222
33333
4444444
555555555
6666666
77777
888
9
2017年04月07日 00点04分
9
14行改成vblf
2017年04月07日 01点04分
吧务
level 13
Option Explicit
' 数字菱形
Private Sub Form_Load()
Me.AutoRedraw = True
Me.FontSize = 14
End Sub
Private Sub Form_Click()
Dim i As Integer, j As Integer
Dim k As Integer, n As Integer
Cls
n = Val(InputBox("请输入 n = ?", "输入层数", "9"))
If n Mod 2 = 0 Then n = n + 1
If n > 9 Then n = 9
Print "层数:n = " & n: Print
For i = 1 To n
If i <= n / 2 + 1 Then
j = n - i + 3
k = (i - 1) * 2 + 1
Else
j = i + 2
k = (n - i) * 2 + 1
End If
Print Tab(j); String(k, CStr(i))
Next i
End Sub
2017年04月07日 03点04分
10
level 11
简易string函数型
for i=-4 to 4
a=abs(i)
b=9-a*2
c=5+i
print a; b; c
next
2017年04月07日 09点04分
12
level 1
Private Sub Command1_Click()
Dim i As Integer, j As Integer
For i = 1 To 9
Print Tab(15 - i);
For j = 1 To 2 * i - 1
Print "*";
Next j
Print
Next i
End Sub
效果(人懒,自己试吧)
2022年09月11日 13点09分
13
level 11
Private Sub Form_Click()
Dim str As String
For i = 1 To 9
For j = 1 To (5 - Abs(i - 5)) * 2 - 1
str = i & str
Next j
Print str
str = ""
Next i
End Sub
2022年09月13日 03点09分
14