首页 > 试题广场 >

阅读下列程序,写出运行结果: #include usi

[问答题]
阅读下列程序,写出运行结果:
#include <iostream>
using namespace std;
int f( int [][3], int, int );
int main()
{
int a[][3] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
cout << f( a, 3, 3 ) << endl;
}
int f( int a[][3], int row, int col )
{
int i, j, t=1;
for( i=0; i<row; i ++ )
   for( j=0; j<col; j++ )
{
a[i][j]++;
if( i == j )  t *= a[i][j];
}
return t;
}

推荐
45
发表于 2018-05-07 11:40:27 回复(0)