利用二维数组实现矩阵的加法运算

问题描述:

利用二维数组实现矩阵的加法运算
不好意思,用VB语言做下
1个回答 分类:综合 2014-11-17

问题解答:

我来补答
#include "stdio.h"
#define M 3
#define N 3
void add(int A[M][N],int B[M][N],int C[M][N])
{
int i,j;
for(i=0; i
再问: 能不能用VB做下
再答: 早说嘛 Module Module3 Sub Add(ByVal A As Integer(,), ByVal B As Integer(,), ByRef C As Integer(,)) Dim i, j As Integer For i = 0 To A.GetLength(0) - 1 For j = 0 To A.GetLength(1) - 1 C(i, j) = A(i, j) + B(i, j) Next Next End Sub Sub Main() Dim i, j As Integer Dim A As Integer(,) = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}} Dim B As Integer(,) = {{2, 3, 4}, {5, 6, 7}, {8, 9, 1}} Dim C As Integer(,) = New Integer(A.GetLength(0), A.GetLength(1)) {} Add(A, B, C) For i = 0 To A.GetLength(0) - 1 For j = 0 To A.GetLength(1) - 1 Console.Write(C(i, j) & vbTab) Next Console.WriteLine() Next End Sub End Module
 
 
展开全文阅读
剩余:2000
下一页:先解十一题