单选题有以下程序: #include #defineN4 voidfun(inta[][N]) {  intb[N][N],i,j;  for(i=0;i   for(j=0;j    b[i][j]=a[N-1-j][i];  for(i=0;i   for(j=0;j    a[i][j]=b[i][j]; } main() {  intx[N][N]={{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}},i;  fun(x);  fun(x);  for(i=0;i   printf("%d,",x[i][i]);  printf(""); } 程序的运行结果是(  )。A16,11,6,1,B1,6,11,16,C4,7,10,13,D13,10,7,4,

单选题
有以下程序: #include  #define N 4 void fun(int a[][N]) {  int b[N][N],i,j;  for(i=0;i   for(j=0;j    b[i][j]=a[N-1-j][i];  for(i=0;i   for(j=0;j    a[i][j]=b[i][j]; } main() {  int x[N][N]={{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}},i;  fun(x);  fun(x);  for(i=0;i   printf("%d,",x[i][i]);  printf(""); } 程序的运行结果是(  )。
A

16,11,6,1,

B

1,6,11,16,

C

4,7,10,13,

D

13,10,7,4,


参考解析

解析:
程序的执行过程为:调用函数fun,将二维数组x地址传入函数,此函数实现将矩阵转置,然后将每一列首尾倒置,调用结果为x[N][N]={{13,9,5,1},{14,10,6,2},{15,11,7,3},{16,12,8,4}}。再次调用函数f,调用结果为x[N][N]={{16,15,14,13},{12,11,10,9},{8,7,6,5},{4,3,2,1}}。输出结果对角线元素,答案选择A选项。

相关考题:

阅读下面程序: include void fun(int n) { int x(5); static int y(10); if(n>0) { 阅读下面程序:include<iostream.h>void fun(int n){int x(5);static int y(10);if(n>0){++x;++y;cout<<x<<","<<y<<end1;}}void main(){int m(1);fun(m);}则该程序的输出结果是______。

该程序运行的结果是( )。#include#include#define M 100void fun(int m, int *a, int *n){ int i,j=0;for(i=1;i=m;i++)if(i%7==0||i==0)a[j++]=i;*n=j;}main(){ int aa[M],n,k;clrscr();fun(10,aa,n);for(k=0;kif((k+1) ==0)printf("\n");else printf("M",aa[k]);printf("\n");}

以下程序的输出结果是【 】。include defineN 5 int fun(int *s,int a,int n) {int j; *s= 以下程序的输出结果是【 】。include <stdio.h>define N 5int fun(int *s,int a,int n){ int j;*s=a j=n;while(a!=s[j]) j-;return j;main(){ int s[N+1]; int k:for(k=1 ;k<=N;k++) s[k]=k+1:print f("%d\n",fun(s,4,N));}

阅读下列程序: include void fun(int n) { int x(5); static int y(10); if(n>0) { 阅读下列程序:include<iostream.h>void fun(int n){int x(5);static int y(10);if(n>0){++x;++y;cout<<x<<","<<y<<endl;}}void main()int m(1);fun(m);}则该程序的输出结果是______。

下列程序的输出结果是 #include"stdio.h" #define N 3 #define M 3 void fun(int a[M][N]) { printf("%d\n",*(a[1]+2));} main() { int a[M][N]; int i,j; for(i=0;i<M;i++) for(j=0;j<N;j++) a[i][j]=i+j-(i-j); fun(a);}A.3B.4C.5D.6

有以下程序 include int fun(char s[]) { int n=O; whil 有以下程序 #include <stdio.h> int fun(char s[]) { int n=O; while(*s<='9'*s>='0') { n=10*n+*s-'0'; s++; } return (n); } main() { char s[10]={ '6', '1', '*', '4', '*', '9', '*', '0', '*'}; printf("%d\n",fun(s)); }A.9B.61490C.61D.5

有以下程序:include int fun(int n){if(n == 1) return 1;else return( n + fun( n - 有以下程序:#include <stdio.h>int fun(int n){ if(n == 1) return 1; else return( n + fun( n - 1 ) );}main( ){ int x; seanf("% d" ,X) ;x = fun(x) ;pfinff( "% d \n" ,x);} 执行程序时,给变量x输入10,程序的输出结果是( )。A.55B.54C.65D.45

有以下程序 include void fun(int n, int *p) { int f1,t2; if(n==1 | 有以下程序 #include <stdio.h> void fun(int n, int *p) { int f1,t2; if(n==1 ||n==2) *p=1; else { fun(n-1,f1); fun(n-2,f2); *p=f1+f2; } } main() { int s; fun(3,s); printf("%d\n", s ); }A.2B.3C.4D.5

以下程序的输出结果是 include long fun(int n) {long s;if(n=1||n=2)s=2; else s= 以下程序的输出结果是 #include<iostream.h> long fun(int n) { long s; if(n=1||n=2)s=2; else s=n-fun(n-1); return s; } void main( ) { cout<<fun(3);}A.1B.2C.3D.4

有以下程序:include define N 20fun(int a[] ,int n,int m){int i,j;for(i=m;i> :n;i 有以下程序: #include <stdio.h> #define N 20 fun(int a[] ,int n,int m) { int i,j; for(i=m;i> :n;i--) a[i+1] =a[i]; } main( ) { int i,a[N.] = 11,2.3,4,5,6,7,8,9,10[; fun( a,2,9) for(i =0;i<5;i ++ ) printf("% d" ,a[i] );程序运行后的输出结果是( )。A.10234B.12344C.12334D.12234

下列程序的输出结果是#include "stdio.h"#define N 3#define M 3void fun(int a[M][N]){ printf("%d\n",*(a[1]+2));}main(){ int a[M][N];int i,j;for(i=0;iM;i++)for(j=0;jN;j++)a[i][j]=i+j-(i-j);fun(a);}A.3B.4C.5D.6

有以下程序 include include int fun(int n) {int * 有以下程序 #include <stdio.h> #include <stdlib.h> int fun(int n) {int *p; p=(int*)malloc(sizeof(int)); *p=n; return *p; } { int a; a=fun(10); printf("%d\n",a+fun(10)); } 程序的运行结果是______。A.0B.10C.20D.出错

有以下程序 include void fun(int a[],int n) { int i,t; for(i=0; 有以下程序 #include <stdio.h> void fun(int a[],int n) { int i,t; for(i=0;i<n/2;i++) {t=a[i]; a[i]=a[n-1-i]; a[n-1-i]=t;} } main() {int k[10]={1,2,3,4,5,6,7,8,9,10},i; fun(k,5); for(i=2;i<8;i++) printf("%d",k[i]); printf("\n"); } 程序的运行结果是______。A.345678B.876543C.1098765D.321678

有以下程序 include define N 4 void fun(int a[][N],int b[]) { int 有以下程序 #include <stdio.h> #define N 4 void fun(int a[][N],int b[]) { int i; for(i=0;i<N;i++) b[i]=a[i][i]; } main() {int x[][N]={{1,2,3},{4},{5,6,7,8},{9,10} },Y[N],i; fun(x,y); for(i=0;i<N;i++) printf("%d,",y[i]); printf("\n"); } 程序的运行结果是______。A.1,2,3,4,B.1,0,7,0,C.1,4,5,9,D.3,4,8,10,

有下列程序: include void fun(int * s,int n1,int n2) { int i,j, 有下列程序: #include <stdio.h> void fun(int * s,int n1,int n2) { int i,j,t; i=n1;j=n2; while(i<j){t=s[i];s[i]=s[j];s[j]=t;i++;j--;} } main() { int a[10]={1,2,3,4,5,6,7,8,9,0},k; fun(a,0,3); fun(a,4,9);fun(a,0,9); for(k=0;k<10;k++)printf("%d",a[k]);printf("\n"); } 程序的运行结果是( )。A.987654321B.4321098765C.5678901234D.987651234

给出以下程序的执行结果【】。 include using namespace std; int n=1; void Fun(); int 给出以下程序的执行结果【 】。include <iostream>using namespace std;int n=1;void Fun();int main (){n++;Fun ( );if (n>0){int n=5;cout<<"Block: n="<<n<< ", ";}cout<< "Main: n="<<end1;return 0;}void Fun ( ){int n=10;cout<<"Fun: n="<<n<<",";}

下列程序的输出结果是 #include"stdio.h" #define N3 #define M3 void fun(int a[M][N]) { printf("%d\n",*(a[1]+2));} main() { int a[M][N]; int i,j; for(i=0;i<M;i++) for(j=0;j<N;j++) a[i][j]=i+j-(i-j); fun(a);}A.3B.4C.5D.6

有以下程序:includedefine N 8void fun(int*x,int i){*x=*(x+i)+1;}main(){int a[N]= 有以下程序: #include<stdio.h> #define N 8 void fun(int*x,int i) {*x=*(x+i)+1;} main() {int a[N]={1,2,3,4,5,6,7,8},i; fun(a,2); for(i=0;i<N/2;i++) {printf("%d",a[i]);} printf("\n"); } 程序运行后的输出结果是( )。A.1 3 1 3B.3 2 3 4C.4 2 3 4D.1 2 3 4

以下程序的输出是【】。 include using namespace std; fun(intm) { static int n=1; n=m 以下程序的输出是【 】。include<iostream>using namespace std;fun(intm){static int n=1;n=m*n;return(n);}void main(){int i;for(i=1;i<=3;i++) cout<<fun(i);}

以下程序的输出结果是#include conio.h#include stdio.h#define M 100void fun(int m, int *a, int *n){ int i,j=0; for(i=1;i=m;i++) if(i%7==0||i%11==0) a[j++]=i; *n=j;}main(){ int aa[M],n,k; clrscr(); fun(100,aa,n); for(k=0;kn;k++) if((k+1)%20==0)printf("\n"); else printf("%d",aa[k]); printf("\n"); }

下面程序的运行结果是include int fun ( int a[ ],int n){int result=1;for(int 下面程序的运行结果是 #include < iostream.h > int fun ( int a[ ],int n) { int result=1; for(int i=1;i<n;i++) result=result*a[i]; return result; } void main( ) { int a[3]={3,4,5}; cout << fun(a,A.12B.15C.20D.60

有以下程序: include int fun(int n) { if(n)return fun(n-1)+n; else return 0; } main( ) { printf("%d\n",fun(3));} 程序的运行结果是( )。 A.4B.5C.6D.7

有以下程序: #include #define N 4 void fun(int a[ ][N],int b[ ]) { int i; for(i=0;i main( ) { int i,j,x=0; for(i=0;iA.x=4B.x=6C.x=8D.x=12

单选题有以下程序:#include#define N 3void fun(int a[ ][N],int b[ ]){ int i,j; for(i=0;iA2,4,8,B3,6,9,C3,5,7,D1,3,5,

单选题有以下程序:#include #define N 4void fun(int a[][N],int b[]){ int i; for(i=0;iA1,2,3,4,B1,0,7,0,C1,4,5,9,D3,4,8,0,

单选题有以下程序:#include void fun(int n){ int i; if((i=n/10)!=0)  fun(i); putchar(n%10+'0');}main(){ fun(256);}程序运行后的输出结果是(  )。A256B652C2560D52

单选题有以下程序:#include #define N 4void fun(int a[][N]){ int i; for(i=0;iA16,6,11,16,B1,6,11,16,C4,7,10,13,D17,17,17,17,

单选题有以下程序:#include #define N 4void fun(int a[][N],int b[]){ int i; for(i=0;iA12,-3,0,0,B-3,-1,1,3,C0,1,2,3,D-3,-3,-3,-3,