回 帖 发 新 帖 刷新版面

主题:求矩阵的和

有两个5×6的矩阵,编程求二矩阵的和

回复列表 (共2个回复)

沙发

cls
for k=1 to 2:for i=1 to 5:for j=1 to 6
input a:s=s+a
next j,i,k
?s
end
根本用不着数组...........简单吧.............

板凳

数组的方法是繁了点:
dim a(5,6),b(5,6),c(5,6)
for i=1 to 5
  for j=1 to 6
    input a(i,j)
    print a(i,j);
  next j
  print
next i
for i=1 to 5
  for j=1 to 6
    input b(i,j)
    print b(i,j);
  next j
  print
next i
for i=1 to 5
  for j=1 to 6
    c(i,j)=a(i,j)+b(i,j)
    print c(i,j);
  next j
  print
next i

我来回复

您尚未登录,请登录后再回复。点此登录或注册