vb代码,生成一个二维数组,打印,格式左对齐,并将数组保存到文件中。
1个回答
展开全部
Dim a(10, 10) As Integer
Dim str As String
Private Sub Command1_Click()
Dim i, j As Integer
For i = 1 To 10
For j = 1 To 10
a(i, j) = Int(Rnd * 5000)
str = str & a(i, j) & Space(7 - Len(CStr(a(i, j))))
Next j
str = str & vbCrLf
Next i
Print str;
End Sub
Private Sub Command2_Click()
'¸²¸ÇдÎļþ
Open "D:\1234567890.txt" For Output As #1
Print #1, str
Close #1
MsgBox ("дÈëÎļþÍê³É£¡")
End Sub
Private Sub Form_Load()
str = ""
End Sub
Dim str As String
Private Sub Command1_Click()
Dim i, j As Integer
For i = 1 To 10
For j = 1 To 10
a(i, j) = Int(Rnd * 5000)
str = str & a(i, j) & Space(7 - Len(CStr(a(i, j))))
Next j
str = str & vbCrLf
Next i
Print str;
End Sub
Private Sub Command2_Click()
'¸²¸ÇдÎļþ
Open "D:\1234567890.txt" For Output As #1
Print #1, str
Close #1
MsgBox ("дÈëÎļþÍê³É£¡")
End Sub
Private Sub Form_Load()
str = ""
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询