奥巴马大脑被植入芯片:用vb帮忙写一个循环,在屏幕上Print出来!

来源:百度文库 编辑:神马品牌网 时间:2024/05/06 17:11:42
1*1=1
1*2=2
.
.
.
9*9=81

Private Sub 确定_Click()
Dim i As Integer
Dim j As Integer
Dim str As String
Me.AutoRedraw = True
For i = 1 To 9
str = ""
For j = 1 To 9
str = str & i & "×" & j & " = "
str = str & i * j
str = str & vbTab
Next j
Print str
Next i
End Sub

Sub main()
For i = 1 To 9
For j = 1 To 9
? i ; "×" ; j ;"=" ; i * j
Next j
Next i
End Sub

VBscript,将下列代码存为***.htm。
**************************************************
<html>
<body bgcolor="#eeeeee">
<br>
<p align="center"><font color="red"><b>九九乘法表</b></font></p>
<script language=vbscript>
dim x,y,s
for x=1 to 9
for y=1 to x
s=x*y
if (y=2 and x=3) or (y=2 and x=4) then
document.write(y&"×"&x&"="&s&" ")
else
document.write(y&"×"&x&"="&s&" ")
end if
next
document.write("<br>")
next
document.write("<title>"+t+"</title>")
</script>
</body>
</html>
********************************************
VB:
Dim x As Integer
Dim y As Integer
Dim str As String
Me.AutoRedraw=True
For x=1 To 9
str=""
For y=1 To 9
str=str&x&"×"&y&"="
str=str&x*y
str=str&vbTab
Next y
Print str
Next x