网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
单选题
有以下程序: #include  void fun(int *s,int n1,int n2) {  int i,j,t;  i=n1;  j=n2;  while(i
A

5678901234

B

0987654321

C

4321098765

D

0987651234


参考答案

参考解析
解析:
程序执行过程为:调用函数fun(p,0,3),将数组a首地址传入函数,循环执行2次,将数组前4个元素前后倒置,数组a={4,3,2,1,5,6,7,8,9,0};调用函数fun(p,4,9),将数组a首地址传入函数,循环执行3次,将数组第5个到第10个元素前后倒置,数组a={4,3,2,1,0,9,8,7,6,5};调用函数fun(p,0,9),将数组a首地址传入函数,循环执行5次,将数组元素前后倒置,数组a={5,6,7,8,9,0,1,2,3,4};依次输出数组元素。答案选择A选项。
更多 “单选题有以下程序: #include voidfun(int*s,intn1,intn2) {  inti,j,t;  i=n1;  j=n2;  while(i A 5678901234B 0987654321C 4321098765D 0987651234” 相关考题
考题 有以下程序#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

考题 有以下程序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 using namespace std; constxntN=5; int fun(char*s,char a,int 有以下程序:include <iostream>using namespace std;const xnt N=5;int fun(char *s,char a,int n){int j;*s=a;j=n;while(a<s[j])j--;return j;}int main(){char s[N+1];int k;

考题 以下程序的输出结果是【 】。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 int fun2(int m) { if(m%3==0) return 1; else return 0; } 阅读下面程序:include <iostream.h>int fun2(int m){if(m%3==0)return 1;elsereturn 0;}void fun1(int m, int s){int i;for (i=1; i<m; i++)if(fun2(i))S=S*i;}void main(){int n=9, s=2;fun1(n, s);cout<<s<<end1;}该程序的运行结果是【 】。

考题 以下程序的输出结果是______。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 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 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 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

考题 有以下程序includevoid fun(float* p1,int n1,float,*p2,int n2,float* s){ int i;s=( 有以下程序 #include<stdio.h> void fun(float * p1,int n1,float,*p2,int n2,float * s) { int i; s=(float *)calloc(1,sizeof(float)); *s=0; for(i=0;i<n1;i++) *s+=*p1++; for(i=0;i<n2;i++) *s+=*p2++; } main() { float a[2]={1.1,2.2},b[3]={10.0,20.0,30.0),*s=a; fun(a,2,b,3,s); printf("%f\n",*s); } 上面程序的输出结果是( )A.60B.3.3C.63.3D.1.1

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

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

考题 若有以下程序:includeusing 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<<endl; } 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.fl(); return 0; } 程序执行后的输出结果是( )。A.3,4B.6,8C.6,9D.4,3

考题 有以下程序#include stdio.hvoid fun(int *s,int n1,int n2){ int i,j,t;i=n1; 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;kl0;k++)printf("%d",a[k]); printf("\n");}程序的运行结果是A.0987654321B.4321098765C.5678901234D.0987651234

考题 有以下程序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 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.fl(); return 0; } 程序执行后的输出结果是A.3,4B.6,8C.6,9D.4,3

考题 以下程序的输出结果是( )。 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 #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]);}程序的运行结果是(  )。A xy,aaaaccB aaaacc,xyC bcc,aabccD aabcc,bcc