题目内容:
请编写函数proc().该函数的功能是:实现B=A+A7,即把矩阵A加上A的转置,存放在矩阵B中。计算结果在main ()函数中输出。 ’例如,输入下面矩阵:
1 1 1
4 4 4
7 7 7
其转置矩阵为:
1 4 7
1 4 7
1 4 7
则程序输出:
2 5 8
5 8 11
8 11 14
注意:部分源程序给出如下。
请勿改动main()函数和其他函数中的任何内容,仅在函数proc()的花括号中填入所编写的若干语句。 .
试题程序:
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void proc(int a[3][3],int b[3][3])
{ }
void main()
{ int arr[3][3]={{1,1,1),{4,4,4},{7,7,7}},
t[3][3];
int i,j。
system("CLS");
proc(arr,t);
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
printf("%7d",t[i][j]);
printf("\n"):
}
}
参考答案:【答案仅供学习,请勿对照自行用药等】
答案解析: