音频配线架工作原理:贴个VB的题,大家帮忙解答一下,呵呵呵。。。
来源:百度文库 编辑:高校问答 时间:2024/08/29 03:13:00
编写程序,建立并输出一个10*10的矩阵,该矩阵对角线元素为1,其余元素都为0。
求代码……
求代码……
'测试通过
Private Sub Command1_Click()
Dim matrix(1 To 10, 1 To 10) As Integer
Dim i, j
For i = 1 To 10
For j = 1 To 10
If i = j Then
matrix(i, j) = 1
Else
matrix(i, j) = 0
End If
Next j
Next i
For i = 1 To 10
For j = 1 To 10
Print matrix(i, j);
Next j
Print
Next i
End Sub
准确无误!添加一个按钮Command1,再输入以下代码:
Private Sub Command1_Click()
dim a(9,9) as integer,i,j as integer
for i=0 to 9
for j=0 to 9
if i=j or i+j=9 then '对角线有2条
a(i,j)=1
else
a(i,j)=0
end if
?a(i,j);
next j
?
next i
end sub