求高手给做一VB变成题,谢谢!
3个回答
展开全部
Option base 1
private sub form_click()
dim ma() as integer
dim N,M as integer
N=inputbox("请输入矩阵的行数")
M=inputbox("请输入矩阵的列数")
dim ma(N,M) as integer
for i=1 to N
for j=1 to M
ma(i,j)=inputbox("请输入数组第"&str(i)&"行第"&str(j)&"列元素值")
next j
next i
print"所建的矩阵为:"
for i=1 to N
for j=1 to M
print ma(i,j);
next j
print
next i
ma=ma(1,1)
for i=1 to N
for j=1 to M
if max<ma(i,j) then
max=ma(i,j)
column=j
row=i
end if
next j
next i
print
print"矩阵最大的元素的值为:";ma(row,column)
print"它所在的行号为:";row;",列号为:";column
end sub
private sub form_click()
dim ma() as integer
dim N,M as integer
N=inputbox("请输入矩阵的行数")
M=inputbox("请输入矩阵的列数")
dim ma(N,M) as integer
for i=1 to N
for j=1 to M
ma(i,j)=inputbox("请输入数组第"&str(i)&"行第"&str(j)&"列元素值")
next j
next i
print"所建的矩阵为:"
for i=1 to N
for j=1 to M
print ma(i,j);
next j
next i
ma=ma(1,1)
for i=1 to N
for j=1 to M
if max<ma(i,j) then
max=ma(i,j)
column=j
row=i
end if
next j
next i
print"矩阵最大的元素的值为:";ma(row,column)
print"它所在的行号为:";row;",列号为:";column
end sub
展开全部
Private Sub Form_click()
Dim n As Integer, m As Integer, a() As Variant, max As Integer
max = 0
n = Val(InputBox(""))
m = Val(InputBox(""))
ReDim a(n, m)
For i = 1 To n
For j = 1 To m
a(i, j) = Int(Rnd * 100)
Print a(i, j);
If a(i, j) > max Then max = a(i, j): x = i: y = j
Next
Print
Next
Print max, x, y
End Sub
Dim n As Integer, m As Integer, a() As Variant, max As Integer
max = 0
n = Val(InputBox(""))
m = Val(InputBox(""))
ReDim a(n, m)
For i = 1 To n
For j = 1 To m
a(i, j) = Int(Rnd * 100)
Print a(i, j);
If a(i, j) > max Then max = a(i, j): x = i: y = j
Next
Next
Print max, x, y
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询