已知类myCircle中包含成员函数void display(),在定义了myCircle [][]d; d = new myCircle[10][8];并完成d的初始化的前提下,下面语句不正确的是:
A: for (int i = 0; i < 10; i++) { for (int j = 0; j < 8; j++) { d[i][j].display(); } }
B: for (int i = 0; i <= 10; i++) { for (int j = 0; j < =8; j++) { d[i][j].display(); } }
C: for (int i = 9; i <=0; i--) { for (int j = 7; j < =0; j--) { d[i][j].display(); } }
D: for (int i = 9; i <=0; i--) { d[i][2].display(); }
A: for (int i = 0; i < 10; i++) { for (int j = 0; j < 8; j++) { d[i][j].display(); } }
B: for (int i = 0; i <= 10; i++) { for (int j = 0; j < =8; j++) { d[i][j].display(); } }
C: for (int i = 9; i <=0; i--) { for (int j = 7; j < =0; j--) { d[i][j].display(); } }
D: for (int i = 9; i <=0; i--) { d[i][2].display(); }
举一反三
- 已知类myCircle中包含成员函数void display(),在定义了myCircle [][]d; d = new myCircle[10][8];并完成d的初始化的前提下,下面语句不正确的是: A: for (int i = 0; i < 10; i++) { for (int j = 0; j < 8; j++) { d[i][j].display(); } } B: for (int i = 0; i <= 10; i++) { for (int j = 0; j < =8; j++) { d[i][j].display(); } } C: for (int i = 9; i <=0; i--) { for (int j = 7; j < =0; j--) { d[i][j].display(); } } D: for (int i = 9; i <=0; i--) { d[i][2].display(); }
- 针对如下三个实现矩阵求和的不同函数:int a[N][N];int sumA( int a[N][N] ){ int i, j; int sum = 0; for ( i = 0; i < N; i++ ) for ( j = 0; j < N; j++ ) sum += a[i][j]; return sum;}int sumB( int a[N][N] ){ int i, j; int sum = 0; for ( j = 0; j < N; j++ ) for ( i = 0; i < N; i++ ) sum += a[i][j]; return sum;}int sumC( int a[N][N] ){ int i, j; int sum = 0; for ( j = 0; j < N; j+=2 ) for ( i = 0; i < N; i+=2 ) sum += ( a[i][j] + a[i+1][j] + a[i][j+1] + a[i+1][j+1] ); return sum;}当N足够大的时候,三个函数的运行时间t1、t2、t3符合下列哪种情况?()[/i][/i][/i][/i] A: t1 > t2 > t3 B: t3 > t1 > t2 C: t2 > t3 > t1 D: t3 > t2 > t1
- 在C语言中,如要给一个较大的[img=54x22]17de83d2fb35c85.png[/img]的数组赋值,以下方式性能较好的是:() A: for ( int i = 0; i <; N; i++ ) for ( int j = N - 1; j >;= 0; j-- ) mat[i][j] = val; B: for ( int i = 0; i <; N; i++ ) for ( int j = 0; j <; N; j++ ) mat[j][i] = val; C: for ( int i = N - 1; i >;= 0; i-- ) for ( int j = N - 1; j >;= 0; j-- ) mat[j][i] = val; D: for ( int i = N - 1; i >;= 0; i-- ) for ( int j = N - 1; j >;= 0; j-- ) mat[j][i] = val;
- 以下程序的运行结果是 。 #include func(int array[][4],int m) {int i,j,k; k=0; for(i=0;i<3;i++) for(j=0;j<4;j++) if(array[i][j][/i]
- println 语句执行了多少次? for (int i = 0; i < 10;i++) for (int j = 0;j < i;j++) System .out.println(i * j)