求做两道简单的VB题

来源:百度知道 编辑:UC知道 时间:2024/06/19 23:34:31
1、给定两个相同维度的矩阵,求和

2、给定矩阵,求最大值

因为电脑上没装VB,老师又着急让交,所以能不能发偶邮箱里:30361286@qq.com

十分感谢您了~~~

1/
dim a(5,5) as integer,b(5,5) as integer,c(5,5) as integer
for i = 0 to 5
for j=0 to 5
a(i,j) = int(rnd * 100)
b(i,j) = int(rnd * 100)
next j
next i

for i = 0 to 5
for j=0 to 5
c(i,j) = a(i,j) + b(i,j)
print c(i,j);
next j
print
next i

2/
dim a(5,5) as integer
dim nmax as integer
for i = 0 to 5
for j= 0 to 5
a(i,j) = int(rnd * 100)
next j
next i
nmax=a(0,0)
for i = 0 to 5
for j= 0 to 5
if nmax < a(i,j) then nmax = a(i,j)
next j
next i
print nmax

1/
dim a(5,5) as integer,b(5,5) as integer,c(5,5) as integer
for i = 0 to 5
for j=0 to 5
a(i,j) = int(rnd * 100)
b(i,j) = int(rnd * 100)
randwize '加入这一句,初始化RND函数的种子的。
next j
next i

for i = 0 to 5
for j=0 to 5
c(i,j) = a(i,j) + b(i,j)
print c(i,j);
next j
print
next i