dim a as integer
dim b as integer
dim c as string
for a=1 to 9
c=" "
for b=1 to 9
c=c & a & “ * " & b & " =" & a*b & vbtab
next b
print c
next a
其中为什么要给变量c 赋予一个空字符串?
c=c & a & “ * " & b & " =" & a*b & vbtab
包括这句的c=c怎么解释啊?
dim a as integer
dim b as integer
dim c as string
for a=1 to 9
c=" "
for b=1 to 9
c=c & a & “ * " & b & " =" & a*b & vbtab
next b
print c
next a
其中为什么要给变量c 赋予一个空字符串?
c=c & a & “ * " & b & " =" & a*b & vbtab
包括这句的c=c怎么解释啊?
Private Sub Command1_Click()
Dim a As Integer '乘数
Dim b As Integer '被乘数
Dim c As String '乘积
'清屏函数
Cls
'列循环(乘数)
For a = 1 To 9
'做完1次循环之后清空乘积变量
c = ""
'行循环(被乘数)
For b = 1 To 9
'c = c是实现这种效果:1*1=1 1*2=2 1*3=3……
'vbTab增加一个Tab空格,不然就会出现这种效果:1*1=11*2=21*3=3……
c = c & a & " * " & b & " =" & a * b & vbTab
Next b
'将结果在窗体中显示
Print c
Next a
End Sub
c=c & a & “ * " & b & " =" & a*b & vbtab
字符串的连接,或者叫字符串的累加也行