有以下程序: Void f(int a[],iht i,int j) { int t; if(i<j) { t=a[i]; a[i]=a[j]; a[j]=t; f(a,i+1,i-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,
有以下程序: Void f(int a[],iht i,int j) { int t; if(i<j) { t=a[i]; a[i]=a[j]; a[j]=t; f(a,i+1,i-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,
相关考题:
有以下程序#includemain()void f(char p[][10], int n ) /* 字符串从小到大排序 */{ char t[10]; int i,j;for(i=0;ifor(j=i+1;jif(strcmp(p[i],p[j])0) {strcpy(t,p[i]); strcpy(p[i],p[j]); strcpy(p[i],t); }}main(){char p[5][10]={“abc”,”aabdfg”,”abbd”,”dcdbe”,”cd”};f(p,5);printf(“%d\n”,strlen(p[0]));}程序运行后的输出结果是( )。A.2B.4C.6D.3
有以下程序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 void f(char p[][10],int n)/*字符串从小到大排序*/ { 有以下程序 #include<string.h> void f(char p[][10],int n)/*字符串从小到大排序*/ { char t[10];int i,j; for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) if(strcmp(p[i],p[j])>0) {strcpy(t,p[i]);strcpy(p[i],p[j]);strcpy(p[j],t);} } main() { char p[5][10]={"abc","aabdfg:,"abbd","dcdbe","cd"}; f(p,5); printf("%d\n",strlen(p[0])); } 程序运行后的输出结果是A.2B.4C.6D.3
有以下程序: 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,
有以下程序,其中函数的功能是将多个字符串按字典顺序排序: includevoid f(char*p[],i 有以下程序,其中函数的功能是将多个字符串按字典顺序排序: # include<string.h> void f(char*p[],int n) {char *t; int i,j; for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) if(strcmp(p[i],p[j])>0){t=p[i];p[i]=p[j]p[j]=t;} } main() {char *p[5]={"abc","aabdfg","abbd","dcdbe","cd"}; f(p,5); printf("%d\n",strlen(p[1])); } 程序运行后的输出结果是 ______。A.2B.3C.6D.4
有以下程序:includevoid f(char p[][10],int n)/* 字符串从小到大排序*/{char t[10]; 有以下程序: #include<string.h> void f(char p[][10],int n) /* 字符串从小到大排序 */ {char t[10];int i,j; for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) if(strcmp(p[i],p[j])>0{strcpy(t,p[i]);strcpy(p[i],p[j]);strcpy([i],t);} } main() {char p[5][10]={"abc","aabdfg","abbd","dcdbe","cd"; f(p,5); printf("%d\n",strlen(p[0])); } 程序运行后的输出结果( )。A.2B.4C.6D.3
有以下程序: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,
有以下程序: 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
有以下程序,其中函数f的功能是将多个字符串按字典顺序排序:include inelude 有以下程序,其中函数f的功能是将多个字符串按字典顺序排序:#include <stdio, h>#inelude <string, h>void f(char * p[ ] ,int n) char * t;int i,j; for(i=0;i<n-1;i++) for(j=i+1 ;j<n;j ++ ) if(strcmp(p[i], p[j])>0) { t =p[i];p[i] =p[j] ;p[j] =t;}}main( ){ char * p [5] = { "abe"." aabdfg"." abbd"," dcdbe"," cd" }; f(P,5 ); printf("% d\n", strlen(p[1]) );}程序运行后的输出结果是( )。A.2B.3C.60D.4
有以下程序,其中函数f的功能是将多个字符串按字典顺序排序: include void f(ch 有以下程序,其中函数f的功能是将多个字符串按字典顺序排序: #include<string.h> void f(char *p[],int n) {char *t;int i,j; for(i=O;i<n-1;i++) for(j=i+1;j<n;j++) if strcmp(p[i],p[j])>0{t=p[i] p[i]=p[j]; p[j]=t; } } main() {char* p[5]=("abc","aabdfg","abbd","dcdbe","cd"}; f(p,5); printf("%d\n",strlen(p[1])); } 程序运行后的输出结果是 ______。A.2B.3C.6D.4
有以下程序: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
有以下程序:includevoid f(char p[][10],int n){char t[10];int i,j;for(i=0;i 有以下程序: #include<string.h> void f(char p[][10],int n) {char t[10];int i,j; for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) if(strcmp(p[i],p[j])>0) {strcpy(t,p[i]);strcpy(p[i],p[j]);strcpy(p[j],t);} } main() {char p[5][10]={"abc","aabdfg","abbd","dedbe","cd"}; f(p,5); printf("%d\n",strlen(p[0]));} 程序运行后的输出结果是( )。A.2B.4C.6D.3
有以下程序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
有以下程序,其中函数f的功能是将多个字符串按字典顺序排序( )。 #includestring.h void f(char*p[],int n) { char*t;int i,j; for(i=0;in-1;i++) for(j=i+1;jn;j++) if(strcmp(p[i],p[j]0){t=p[i];p[i]=p[j];p[j] =t;} } main { char *P[5]={"abe","aabdfg","abbd","dcd- be","cd"}; f(p,5); printf("%d\n",strlen(p[1])); } 程序运行后的输出结果是( )oA.2B.3C.6D.4
有以下程序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
有以下程序: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
有以下程序: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
有以下程序 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
写出模板函数实现数值型数组元素值按从小到大排序的程序。includeiostreamusing namespace std;template class Tvoid sort(T b[],int n){T temp;int i,j;T *a=new T[n];for (i=0;in;i++){a[i]=b[i];}for(i=0;in-1;i++){for(j=i+1;jn;j++){ if(a[i]a[j]){temp=a[i];a[i]=a[j];a[j]=temp;}}}for(i=0;in;i++){couta[i] ;}coutendl;delete []a;}void main(){int i,n=6;int a[]={5,1,9,10,3,8};____________;for(i=0;in;i++){couta[i] ;}coutendl;}
有以下程序 include int f(iht n) { if(n==1) return 1; else return f(n-1)+ 有以下程序 #include<iostream.h> int f(iht n) { if(n==1) return 1; else return f(n-1)+1;} void main( ) { iht i,j=0; for(i=1;i<3;i++)j+=f(i); cout < < j;} 程序运行后的输出结果是A.4B.3C.2D.1
有以下程序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
有以下程序,其中函数f的功能是将多个字符串按字典顺序排序includevoid f(char*p[],in 有以下程序,其中函数f的功能是将多个字符串按字典顺序排序 #include <string,h> void f(char *p[], int n) { char *t; int i,j; for(i=0; i<n-1; i++) for(j=i+1;j<n; j++) if(strcmp(p[i],p[j])>0) {t=p[i];p[i]=p[j]; p[j]=t;} } main() { char *p[5]={"abc","aabdfg","abbd","dcdbe","cd"}; f(p,5); printf("%d\n"。strlen(p[1])); } 程序运行后的输出结果是A.2B.3C.6D.4
有以下程序 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,1B.5,2,3,4,1,C.1,2,3,4,5D.1,5,4,3,2,
有以下程序:include void f(char p[][10],int n)/* 字符串从小到大排序 */{ char t[1 有以下程序: #include <string.h> void f(char p[][10],int n)/* 字符串从小到大排序 */ { char t[10]; int i,j; for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) if(strcmp(p[i],p[j])>0) { strcpy(t,p[i]); strcpy(p[i],p[j]); strcpy(p[j],t); } } main() {char p[5][10]={"abc","aabdog","abbd","dcdbe","cd"}; f(p,5); printf("%d\n",strlen(p[0])); } 程序运行后的输出结果是( )。A.2B.4C.6D.3
单选题有以下程序:#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