单选题有以下程序:#includevoid fun(int *x,int s, int e){ int i,j,t; for(i=s,j=e;iA4567890123B3210987654C9876543210D0987651234
单选题
有以下程序:#includevoid fun(int *x,int s, int e){ int i,j,t; for(i=s,j=e;i
A
4567890123
B
3210987654
C
9876543210
D
0987651234
参考解析
解析:
程序的执行过程为:定义数组m,并为其赋初值,数组长度为10。调用函数fun(m,0,3)将数组首地址传入函数,函数实现将数组下标值从0到3的元素首尾倒置,for循环结束之后数组为m={3,2,1,0,4,5,6,7,8,9}。调用函数fun(m+4,0,4)将数组下标值为4的元素地址传入函数,函数实现将数组下标值从4到9的元素首尾倒置,for循环结束之后数组为m={3,2,1,0,9,8,7,6,5,4}。调用函数fun(m,0,9)将数组首地址传入函数,函数实现将数组下标值从0到9的元素首尾倒置,for循环结束之后数组为m={4,5,6,7,8,9,0,1,2,3}。依次输出数组元素,结果为4567890123。答案选择A选项。
相关考题:
有以下程序#include stdio.hvoid fun(int *s,int nl,int n2){ int i,j,t;i=nl; j=n2;while(ij) {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;k10;k++)printf("%d",a[k]); printf("\n");}程序运行的结果是 ( )A)0987654321B)4321098765C)5678901234D)0987651234
以下程序的输出结果是 【 11 】 。#include stdio.hint fun(int x){ static int t=0;return(t+=x);}main(){ int s,i;for(i=1;i=5;i++) s=fun(i);printf("%d\n",s);}
有以下程序inclUdevoidfun(int*s,intn1,intn2){inti,j,t;i=n1;j=n2;while(i 有以下程序 #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,4A.0987654321B.4321098765C.5678901234D.0987651234
有以下程序:includeincludevoid fun(char s[][10],int n){char t;int i,j; 有以下程序: #include<stdio.h> #include<string.h> void fun(char s[][10],int n) { char t;int i,j; for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) /*比较字符串的首字符大小,并交换字符串的首字符*/ if(s[i][0]>s[j][0]){t=s[i][0];s[i][0]=s[j][0];sEj][0]=t;} } main() {char s[5][10]={"bcc","bbcc","xy","aaaacc","aabcc"); fun(ss,5);printf("%s,%s\n",ss[0],ss[4]); } 程序的运行结果是( )。A.xy,aaaaccB.aaaacc,xyC.xcc,aabccD.acc,xabcc
有以下程序 void fun(int*a,int i,int j) { int t; if(i<j) { t=a[i];a[i]=a[j];a[j]=t; i++; j--; fun(a,i,j); } } main() { int x[]={2,6,1,8},i; fun(x,0,3); for(i=0;i<4;i++) printf("%2d",x[i]); printf("\n"); } 程序运行后的输出结果是A.1 2 6 8B.8 6 2 1C.8 1 6 2D.8 6 1 2
有以下程序:int f(int b[][4]){int i,j,s=0;for(j=0;i2)i=3-j;s+=b[i][j];}ret 有以下程序: int f(int b[][4]) { int i,j,s=0; for(j=0;i<4;i++) { i=j; if(i>2) i=3-j; s+=b[i][j]; } return s; } main() { int a[4][4]={{1,2,3,4,},{0,2,4,6},{3,6,9,12},{3,2,1,0}}; printf("%d\n",f(a)); } 执行后的输出结果是( )。A.12B.11C.18D.16
有以下程序#include stdio.h#include string.hvoid fun(char *s[],int n){ char *t; int i,j;for(i=0;in-1;i++)for(j=i+1;jn;j++)if(strlen(s[i])strlen(s[j])) {t=s[i];s[i]:s[j];s[j]=t;}}main(){ char *ss[]={"bcc","bbcc","xy","aaaacc","aabcc"};fun(ss,5); printf("%s,%s\n",ss[0],ss[4]);}程序的运行结果是A.xy,aaaaccB.aaaacc,xyC.bcc,aabccD.aabcc,bcc
有以下程序: void fun(int *a,int i,int i) { int t; if(i<j) { t==a[i];a[i]=a[j];a[i]=t; i++; j--; fun(a,i,j); } } main() { int x[]={2,6,1,8),i; fun(x,0,3), for(i=0;i<4;i++) printf("%2d",x[i]); printf("\n"); } 程序运行后的输出结果是( )。A.1268B.8621C.8162D.8612
以下程序的输出结果是【 】。include int fun(int x) {static int t=0; return(t+=x); } 以下程序的输出结果是【 】。include <stdio.h>int fun(int x){ static int t=0;return(t+=x);}main()int s,i;for(i=1 ;i<=5;i++) s=fun(i);printf("%d\n",s);
有以下程序:includeincludevoid fun(char*s[],int n){char*t;int i,j;for( 有以下程序: #include<stdio.h> #include<string.h> void fun(char*s[],int n) { char*t;int i,j; for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) if(strlen(s[i])>strlen(s[j])){t=s[i];s[i]=s[j];s[j]=t;} } main() { Char*ss[]={"bcc","bbcc","xy","aaaacc","aabcc"}; fun(ss,5);printf("%s,%s\n",ss[0],ss[4]); } 程序的运行结果是( )。A.xy,aaaaccB.aaaacc,xyC.bcc,aabccD.aabcc,bcc
有以下程序includeincludevoidfun(char*s[],intn){char*t;int i,j;for(i=0 有以下程序 #include <stdio.h> #include <string.h> void fun(char *s[],int n) { char *t; int i,j; for(i=0;i<n-1;++) for(j=i+1;j<n;j++) if(strlen(s[i])>strlen(s[j])) {t=s[i];s[i];s[j];s[j]=t;} } main() { char *ss[]={"bccA.xy,aaaaccB.aaaacc,xyC.bcc,aabccD.aabcc,bcc
有以下程序:include void fun(iht * a,int i,int j){int t;if(i 有以下程序:#include <stdio, h>void fun(iht * a,int i,int j){ int t; if(i < j) { t=a[i];a[i] =a[j] ;a[j]=t; i++;j--; fun(a,i,j);main ( ) int x[ ]: {2,6,1,8} ,i; fun(x,0,3); for( i=0;i <4;i ++ ) printf( "%2d" ,x[i] ); printf(" \n");A.1268B.8621C.8162D.8612
以下程序的输出结果是( )。 void fun(int*a,int i,int i) {int t; if(ii) { t=a[i[;a[i]=a[j];a[j]一t; i++;j--;fun(a,i,j); } } main { int K[]={2,6,1,8},i; fun(x,0,3); for(i=0;i1;i++)printf("%2d",x[i]); printf("\n"); }A.1,2,6,8B.8,6,2,1C.8,1,6,2D.8,6,1,2
有下列程序: 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
有以下程序void fun(int* a, int i, int j){ int t; if(i<j); { t =a[i] ;a[i]= a[j] ;a[i]= t; fun(a, ++i, --j);}}main(){ int a[i]={1,2,3,4,5,6}, i; fun(a,0,5); for(i=0;i<6; i++) cout<<a[i];}执行后输出结果是A.654321B.432156C.456123D.123456
有以下程序: void fun( int *a, int i, int j) { int t; if ( i<j ) { t=a[i];a[i]=a[j];a[j]=t; fun (a,++i,--j); } } main() { int a[]={1,2,3,4,5,6),i; fun(a,0,5) for( i=0; i<6; i++) printf("%d",a[i]); } 执行后的输出结果是( )。A.654321B.432156C.456123D.123456
分析以下程序的执行结果【】。include class S{ int A[10]; public: int operato 分析以下程序的执行结果【 】。include <iostream. h>class S{int A[10];public:int operator () (int);};int S: :operator() (int x) {return A[x];}void main() {S a;int i,j;for (i=0; i<10; i++)a(i)=i*2;for (i=0; i<10; i++)cout<<a(i)<<" ";cout<<end1; }
有以下程序:struct S{int n;int a[20];};void f(struct S*P){int i,j,t;for(i=0;in-1;i++)fo 有以下程序: struct S{int n;int a[20];}; void f(struct S*P) { int i,j,t; for(i=0;i<P->n-1;i++) for(j=j+1;j<P->n-1;j++) if(p->a[i]>p->a[j]) {t=P->a[i];p->a[i]=P->a[j];p->a[j]=t} } main() {int i;struct S s{10,{2,3,1,6,8,7,5,4,10,9}}; f(&s); for(i=0;i<s.n;i++)printf("%d",s.a[i]);} 程序运行后的输出结果是( )。A.3B.4C.5D.6
以下程序的输出结果是______。 main () { int x=5,n=3,s,j; for(j=0;j<2;j++) { s=fun(x,n); printf("%d",s); } } fun(int a,int b) { static int n=0,i=2; i=n+1; n=i+a-b; return(n); }A.3 7B.3 5C.3 6D.3 3
有以下程序 void fun(int *a,int i,int j) { int t; if (i<j) { t=a[j]; a[i]=a[j]; a[j]=t; i++; j--; fun(a,i,j); } } main() { int x[]={2,6,1,8},i; fun(x,0,3); for(i:0;i<4;i++) printf("%2d",x[i]); } 程序运行后的输出结果是______。A.1 2 6 8B.8 6 2 1C.8 1 6 2D.8 6 1 2
有以下程序:include int fun(int x[], int n){ static int sum =0,i;for(i=0;i 有以下程序: #include <stdio.h> int fun(int x[], int n) { static int sum =0,i; for(i=0;i<n;i ++ )sum + =x[i]; return sum;{ int a[] ={1,2,3,4,5},b[]={6,7,8,9},s=0; s = fun(a,5) + fun(b,4) ;printf( "%d \n",s);程序执行后的输出结果是( )。A.45B.50C.60D.55
有以下程序includevoidfun(int*s,intn1,intn2){inti,j,t; i=n1j=n2; while(i 有以下程序 #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
有以下程序includeincludevoidfun(char,*s[],intn){char*t;inti,j; for(i= 有以下程序 #include <stdio.h> #include <string.h> void fun(char,*s[],int n) { char *t; int i,j; for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) if(strlen(s[i])>strlen(s[j])) {t=s[i];s[i]:s[j];s[j]=t;} } main() { char *ss[]={"bcc","bbcc","xy","aaaacc","aabcc"}; fun(ss,5); printf("%s,%s\n",ss[0],ss[4]); } 程序的运行结果是A.xy,aaaaccB.aaaacc,xyC.bcc,aabccD.aabcc,bcc
有以下程序:int f(int b[][4]){int i, j, s=0;for(j=0; j2)i=3-j;S+=b[i][j]; 有以下程序: int f(int b[][4]) { int i, j, s=0; for(j=0; j<4; j++) { i=j; if(i>2)i=3-j; S+=b[i][j]; } return s; } main() { int a[4][4]={{1, 2, 3, 4}, {0, 2, 4, 6}, {3, 6, 9, 12}, {3, 2, 1, 0}}; printf("%d\n", f(a)); } 执行后的输出结果是______。A.12B.11C.18D.16
有以下程序: void fun(int *a,int i,int j) { int t; if(i<j) { t=a[i];a[i]=a[j];a[j]=t; i++; j--; fun(a,ij); } } main() { int x[]={2,6,1,8},i; fun(x,0,3); for(i=0;i<4;i++) printf("%2d",x[i]); printf("\"n); } 程序运行后的输出结果是( )。A.1 2 6 8B.8 6 2 1C.8 1 6 2D.8 6 1 2
main( ){ int a[6]={10,20,30,40,50,60},i;invert(a,0,5);for(i=0;i6;i++) printf(“%d,”,a[i]);printf(“\n”);}invert(int s[ ],int i,int j){ int t;if(iJ){ invert(s,i+1j-1);t=s[i];s[i]=s[j];s[j]=t;}}
单选题有以下程序:#include #include void fun(char *s[],int n){ char *t; int i,j; for(i=0;i for(j=i+1;j if(strlen(s[i])strlen(s[j])) { t=s[i]; s[i]=s[j]; s[j]=t; }}main(){ char *ss[]={"bcc","bbcc","xy","aaaacc","aabcc"}; fun(ss,5); printf("%s,%s",ss[0],ss[4]);}程序的运行结果是( )。Axy,aaaaccBaaaacc,xyCbcc,aabccDaabcc,bcc