有以下程序: void sott(int a[], int n) { int i, j, t; for(i=0; i<n-1; i++) for(j=i+1; j<n; j++) if(a[i]<a[j]){t=a[i];a[i]=a[j];a[j]=t;) } main() {int aa[10]={1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, I; sort(aa+2, 5); for (i=0; i<10; i++)printf("% d", aa[i]); printf("\n"); } 程序运行后的输出结果是______。A.1, 2, 3, 4, 5, 6, 7, 8, 9, 10,B.1, 2, 7, 6, 3, 4, 5, 8, 9, 10,C.1, 2, 7, 6, 5, 4, 3, 8, 9, 10,D.1, 2, 9, 8, 7, 6, 5, 4, 3, 10,

有以下程序: void sott(int a[], int n) { int i, j, t; for(i=0; i<n-1; i++) for(j=i+1; j<n; j++) if(a[i]<a[j]){t=a[i];a[i]=a[j];a[j]=t;) } main() {int aa[10]={1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, I; sort(aa+2, 5); for (i=0; i<10; i++)printf("% d", aa[i]); printf("\n"); } 程序运行后的输出结果是______。

A.1, 2, 3, 4, 5, 6, 7, 8, 9, 10,

B.1, 2, 7, 6, 3, 4, 5, 8, 9, 10,

C.1, 2, 7, 6, 5, 4, 3, 8, 9, 10,

D.1, 2, 9, 8, 7, 6, 5, 4, 3, 10,


相关考题:

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

阅读下列程序说明和C代码,把应填入其中n处的字句写在答卷的对应栏内。【说明】程序利用选择排序算法对数组a中的N个整数按照从小到大的顺序排列,并将排序结果显示出来。【程序】define N 10main(){void (1);int i,a[N];for(i=0;i<10,i++) /*输入*/scanf(“%d”,a[i]);(2);for(i=0;i<N,i++) /*输出*/printf(“%3d”,a[i]);}void selectSon(int x[],int n){int i,j,k,t;for(int i=0; (3);i++){k=i;for(j=i+1;j<n;j++)if (4) k=j;if (5){t=x[i];x[i]=x[k];x[k] =t;}}}

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

以下程序的输出结果是 ( ) main( ) { int n[3] [3],i,j; for (i=0;i<3;i+ +) for(j=0;i<3;++) n[i][j]=i+j; for(i=0;i<2;i++) for(j=0,j<2;j++) n[i+1][j+1]+=[i][j]; printf("%d\n",n[1][j]); }A.14B.0C.6D.值不确定

有下列程序: include include "string.h" void tim(char *s[],int n) 有下列程序: #include <stdio.h> #include "string.h" void tim(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]; 有以下程序: #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 "string.h"#include "stdio.h"sort(char *a[],int n){ int i,j;char *p;for(j=1;j=n-1;j++)for(i=0; 【15】 ;i++)if( 【16】 0){ p=a[i];a[i]=a[i+1];a[i+1]=p;}}main(){ int i;char *book[]={"itisme","itisyou","howareyou","fine","goodnight","goodbye"};sort( 【17】 );for(i=0;i6;i++)printf("%s\n",book[i]);}

本程序用冒泡法对数组a[]的元素从大到小排序,请在程序空白处填空。 void bubble(int a[],int n) {int i,j,max,temp; max=n-1; do{j=0; for(i=0;i<max;i++) if(a[i]<a[i+1]) {temp=a[i];a[i]=a[i+1];a[i+1]=temp; j=i; } max=j; }while(( )); }

下列程序的输出结果是 #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 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

有以下程序:include using namespace std;int main ( ){ int n[3],i,j,k = 2; for(i 有以下程序: #include <iostream> using namespace std; int main ( ) { int n[3],i,j,k = 2; for(i = 0;i<k;i++) n[i] = O; for(i = O;i<k;i++) { for(j = O;j<k;j++) n[j] = n[i] + 1; } cout<<n [0 ] <<end1; return 0; } 上述程序运行后,输出结果是( )。A.0B.1C.2D.3

有以下程序 main() { int n[3],i,j; for(i=0;i<3;i++)n[i]=0; for(i=0;i<2,i++) for(j=0;j<2;j++)n[j]=n[i]+1; printf("%d\n",n[1]); } 程序运行后的输出结果是( )A.2B.1C.0D.3

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

include void sort(inta[],int n) {int i,j,t;for(i=0;i include<stdio.h>void sort(inta[],int n){int i,j,t;for(i=0;i<n-1;i++)for(j=i+1;<n;j++)if(a[i]<a[j]){t=a[i];a[i]=a[j];a[j]=t;}}main(){int a[10]={1,2,3,4,5,6,7,8,9,10},i;sort(a[1],7);for(i=0;i<10;i++)printf("%d,",a[i]);}程序运行后的输出结果是( )。A.1,2,3,4,5,6,7,8,9,10,B.10,9,8,7,6,5,4,3,2,1,C.1,8,7,6,5,4,3,2,9,10,D.1,2,10,9,8,7,6,5,4,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

阅读以下函数说明和C语言函数,将应填入(n)处的字句填写在对应栏内。[函数2.1说明]函数fun1 (int m, int k, int xx [])的功能是:将大于整数m且紧靠m的k个素数存入数组xx中传回。例如:若输入17,5,则应输出:19,23,29,31,37。[函数2.1]fun1 (int m, int k, int xx [] ){inti, j, s=0;for ( i=m+1; k>0; i++ ){for (j=2; j<i; j++ )if ( i %j=0 )(1)if( i==j ){(2)k--; }}}[函数2.2说明]函数void fun 2 ()的功能是:打印出杨辉三角形(要求打印出10行)。[函数2.2]void fun2 ( ){int i, j;int a[10][10];printf ("\n" );for (i=0; i<10; i++{a [i] [0]=1;(3))for (i=2; i<l0; i++ )for (j=1; j<i; j++)(4)for (i=0; i<10; i++ ){for (j=0; j<=i; j++ )(5)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

有以下程序: void sort(int a[], int n) {int i,j,t; for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) if(a[i]<a[j]) { t=a[i]; a[i]=a[j]; a[j]=t; } } main() { int aa[10]={1,2,3,4,5,6,7,8,9,10},i; sort(aa+2,5); for(i=0;i<10;i++)printf("%d,",aa[i]); printf("\n"); } 程序运行后的输出结果是( )。A.1,2,3,4,5,6,7,8,9,10,B.1,2,7,6,3,4,5,8,9,10,C.1,2,7,6,5,4,3,8,9,10,D.1,2,9,8,7,6,5,4,3,10,

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

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

写出模板函数实现数值型数组元素值按从小到大排序的程序。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;}

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

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