早教吧 育儿知识 作业答案 考试题库 百科 知识分享

已知2个3×4的矩阵(A矩阵、B矩阵),求它们的和(C矩阵)与差(D矩阵).输出时,ABCD四个矩阵分别位于界面的四个角,并注明"A矩阵"\"B矩阵"\"C矩阵"\"D矩阵"

题目详情
已知2个3×4的矩阵(A矩阵、B矩阵),求它们的和(C矩阵)与差(D矩阵).
输出时,ABCD四个矩阵分别位于界面的四个角,并注明"A矩阵"\"B矩阵"\"C矩阵"\"D矩阵"
▼优质解答
答案和解析
dim C(1 to 3,1 to 4) as integer,D(1 to 3,1 to 4 ) as integer
dim i as integer,j as integer
for i=1 to 3
for j=1 to 4
c(i,j)=a(i,j)+b(i,j)
d(i,j)=a(i,j)=b(i,j)
next j
next i
for i=1 to 3
for j=1 to 4
print a(i,j);space(20);b(i,j);
next j
print
next i
print "A矩阵";space(20);"B矩阵"
print
print
print
print
for i=1 to 3
for j=1 to 4
print c(i,j);space(20);d(i,j);
next j
print
next i
print "C矩阵";space(20);"D矩阵"