45、程序定义了N×N的二维数组,并在主函数中自动赋值。请编写函数fun,函数的功能是:使数组右上三角元素中的值乘以m 。
例如:若m的值为2,a 数组中的值为
| 1 9 7 | | 2 18 14|
a = | 2 3 8 | 则返回主程序后a数组中的值应为 | 2 6 16|
| 4 5 6 | | 4 5 12|
注意: 部分源程序存在文件PROG1.C文件中。
请勿改动主函数main和其它函数中的任何内容, 仅在函数fun的花括号中填入你编写的若干语句。
#include #include #define N 5
void fun ( int a[][N], int m )
{ }
main ( )
{ int a[N][N], m, i, j;void
printf("***** The array *****\n");
for ( i =0; i printf("\n");
}
do m = rand() ; while ( m>=3 );
printf("m = M\n",m);
fun ( a ,m );
printf ("THE RESULT\n");
for ( i =0; i }
}
| 广告合作:400-664-0084 全国热线:400-664-0084 Copyright 2010 - 2017 www.my8848.com 珠峰网 粤ICP备15066211号 珠峰网 版权所有 All Rights Reserved
|