单选题有以下程序 #include voidfun(int*a,intn) {  intt,i,j;  for(i=0;i   for(j=i+1;j    if(a[i]    {     t=a[i];     a[i]=a[j];     a[j]=t;    } } main() {  intc[10]={1,2,3,4,5,6,7,8,9,0},i;  fun(c+4,6);  for(i=0;i  printf(""); } 程序的运行结果是(  )。A1,2,3,4,9,8,7,6,5,0,B0,9,8,7,6,5,1,2,3,4,C0,9,8,7,6,5,4,3,2,1,D1,2,3,4,5,6,7,8,9,0,

单选题
有以下程序 #include  void fun(int *a,int n) {  int t,i,j;  for(i=0;i   for(j=i+1;j    if(a[i]    {     t=a[i];     a[i]=a[j];     a[j]=t;    } } main() {  int c[10]={1,2,3,4,5,6,7,8,9,0},i;  fun(c+4,6);  for(i=0;i  printf(""); } 程序的运行结果是(  )。
A

1,2,3,4,9,8,7,6,5,0,

B

0,9,8,7,6,5,1,2,3,4,

C

0,9,8,7,6,5,4,3,2,1,

D

1,2,3,4,5,6,7,8,9,0,


参考解析

解析:
在本题中,主函数在调用fun函数进行排序时,传递的参数是c+4和6,fun函数实现的功能是将数组c的第5个元素开始的6个元素依次进行从大到小的顺序排列。排序之后,数组c的内容变为{1,2,3,4,9,8,7,6,5,0}。答案选择A选项。

相关考题:

有以下程序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

该程序运行的结果是( )。#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 void f(int a[],int i, int j){int t; if(i 有以下程序: #include <stdio.h> void f(int a[],int i, int j) { int t; if(i<j) { t=a[i];a[i]=a[j];a[j]=t; f(a,i+1,j-1); } } main() { int i,aa[5]={1,2,3,4,5}; f(aa,0,4); for(i=0;i<5;i++) printf("%d,",aa[i]);printf("\n"); } 执行后的输出结果是( )。A.5,4,3,2,1,B.5,2,3,4,1,C.1,2,3,4,5,D.1,5,4,3,2,

以下程序的输出结果是______。include void swap(int *a, int *b){ int *t;}{ int i=3,j 以下程序的输出结果是______。include <stdio.h>void swap(int *a, int *b){ int *t;}{ int i=3,j=5,*p=i,*q=j;swap(p,q); printf("%d %d\n",*p,*q);

有以下程序 include include void fun(char s[][10],int n 有以下程序 #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 0--i+l; j<n; j++) /*比较字符串的首字符大小,并交换字符串的首字符*/ if(s[i][0] > s[j][0]) { t = s[i][0]; s[i][0] = s[j][0]; s[j][0] = t;} } main() { char ss[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 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 void fun(int *a, int n)/* fun 函数的功能是将a所指数 有以下程序 #include <stdio.h> void fun(int *a, int n)/* fun 函数的功能是将a所指数组元素从大到小排序*/ { int t, i,j; for (i=0; i<n-1 ;i++) for 0=i+l; j<n; j++) if(a[i]<a[j]) { t=a[i]; a[i]=a[j]; a[j]=t; } } main() { int c[10]= { 1,2,3,4,5,6,7,8,9,0},i; fun(c+4, 6); for (i=0;i<10; i++) printf("%d,", c[i]); printf("\n"); }A.1,2,3,4,5,6,7,8,9,0,B.0,9,8,7,6,5,1,2,3,4,C.0,9,8,7,6,5,4,3,2,1,D.1,2,3,4,9,8,7,6,5,0,

有以下程序: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

有以下程序: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 using namespace std;class A{public: A(int i,int j) { a=i; b= 有以下程序: #include <iostream> using namespace std; class A { public: A(int i,int j) { a=i; b=j; } void move(int x,int y) { a+=x; b+=y; } void show() { cout<<a<<","<<b<<end1; } private: int a,b; }; class B: private A { public: B(int i,int j): A(i,j) {} void fun() { move(3,5); } void fl () { A::show(); } }; int main() { B d(3,4); d.fun(); d.f1(); return 0; } 程序执行后的输出结果是A.3,4B.6,8C.6,9D.4,3

有以下程序:include using namespacestd;class A{public:A(int i,int j){ a=1; b=j;} 有以下程序:#include <iostream>using namespace std;class A{public: A(int i,int j) { a=1; b=j; } void move (int x,int y) { a+=x; b+=y; } void show() cout<<a<<","<<b<<end1 } private: int a,b; }; class B : private A { public: B(int i,int 3):A (i,j) {} void fun() { move (3,5); } void f1() { A::show(); } }; int main() { B d(3,4); d.fun(); d.f1(); return 0; } 程序执行后的输出结果是A.3,4B.6,8C.6,9D.4,3

有以下程序: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

有以下程序 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

有以下程序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 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 using namespace std;class A{public: A(int i,int j) {a=i;b=j 若有以下程序 #include <iostream> using namespace std; class A { public: A(int i,int j) { a=i; b=j; } void move(int x, int y) { a+=x; b+=y; } void show() { cout < <a < <" , " <<b<< end1; } private: int a,b; }; class B : private A { public: B(int i,int j) :A(i,j) {} void fun ( ) { move (3, 5); } void f1 ( ) { A::show(); } }; int main ( ) { B d(3,4); d. fun ( ); d.f1(); return 0; } 程序执行后的输出结果是 ( )。A.3,4B.6,8C.6,9D.4,3

以下程序的输出结果是#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"); }

有以下程序:includeinclude"string.h"void 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[]={"bee","bbcc","xy","aaaacc","aabcc"}; fun(ss,5);printf("%s,%s\n",ss[0],ss[4]); } 程序的运行结果是( )。A.xy,aaaaccB.aaaacc,xyC.bcc,aabccD.aabcc,bcc

有以下程序:include using namespace std;void fun(int i,int j){ cout 有以下程序: #include <iostream> using namespace std; void fun(int i,int j) { cout<<(i+j)<<end1; } void fun(int i) { cout<<i++<<end1; } int main() { int a=1; fun(A) ; return 0; } 该程序执行后的输出结果是( )。A.1B.2C.3D.4

有以下程序 include void fun(int *a,int n)/*fun函数的功能是将a所指数组元素从大到 有以下程序#include <stdio.h>void fun(int *a,int n)/*fun函数的功能是将a所指数组元素从大到小排序*/{ int t,i,j;for(i=0;i<n-1;j++)for(j=i+1;j<n;j++)if(a[i]<a[j]) { t=a[i];a[i]=a[j];a[j]=t;}}main( ){ int c[10]={1,2,3,4,5,6,7,8,9,0},i;fun(c+4,6);for(i=0;i<10;i++) printf("%d,",c[i]);printf("\n");}程序的运行结果是A.1,2,3,4,5,6,7,8,9,0,B.0,9,8,7,6,5,1,2,3,4,C.0,9,8,7,6,5,4,3,2,1,D.1,2,3,4,9,8,7,6,5,0,

有以下程序: #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

有以下程序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

以下程序的输出结果是( )。 include void swap(int*a,int*B){int*t; t=a;a=b;b=c;} main 以下程序的输出结果是( )。 include<stdio.h> void swap(int*a,int*B){int*t; t=a;a=b;b=c;} main() {int i=3,j=5,*p=i,*q=j; swap(p,q);printf("%d %d\n",*p,*q); }

单选题有以下程序:#include void fun(int a[],int n){ int i,t; for(i=0;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 printf("");}程序运行的结果是(  )。A345678B876543C1098765D321678