vb编程题,编写程序,输出一个5*5矩阵,该矩阵对角线元素值为1,其他元素均为0。
1个回答
展开全部
Private Sub Command1_Click()
Dim i As Integer, j As Integer, str As String
For i = 1 To 5
str = ""
For j = 1 To 5
If i = j Or i + j = 6 Then
str = str & "1" & vbTab
Else
str = str & "0" & vbTab
End If
Next
Debug.Print str
Next
End Sub
Dim i As Integer, j As Integer, str As String
For i = 1 To 5
str = ""
For j = 1 To 5
If i = j Or i + j = 6 Then
str = str & "1" & vbTab
Else
str = str & "0" & vbTab
End If
Next
Debug.Print str
Next
End Sub
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询