VB测试题目!请朋友帮忙做哈哦!谢谢...急!
用1、2、3这3个数字组成三位数。编写程序,打印出所有可能的三位数(三个数字可以相同),在窗体上每行打印五个,并统计出所组成的三位数的个数。参考运行结果如下图:窗体文件和...
用1、2、3这3个数字组成三位数。编写程序,打印出所有可能的三位数(三个数字可以相同),在窗体上每行打印五个,并统计出所组成的三位数的个数。参考运行结果如下图:窗体文件和工程文件主名均为“你的姓名+two”,如“张三two”
展开
1个回答
展开全部
'一个Command
Private Sub Command1_Click()
Dim i As Long
Dim j As Long
Dim k As Long
Dim nCount As Long
Dim s As String
Me.Cls
Me.AutoRedraw = True
For i = 1 To 3
For j = 1 To 3
For k = 1 To 3
s = s & " " & i & j & k
nCount = nCount + 1
If nCount Mod 5 = 0 Then
Print s
s = ""
End If
Next k
Next j
Next i
If Len(s) > 0 Then
Print s
End If
Print "个数:" & nCount
End Sub
Private Sub Command1_Click()
Dim i As Long
Dim j As Long
Dim k As Long
Dim nCount As Long
Dim s As String
Me.Cls
Me.AutoRedraw = True
For i = 1 To 3
For j = 1 To 3
For k = 1 To 3
s = s & " " & i & j & k
nCount = nCount + 1
If nCount Mod 5 = 0 Then
Print s
s = ""
End If
Next k
Next j
Next i
If Len(s) > 0 Then
Print s
End If
Print "个数:" & nCount
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询