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

题目内容 (请给出正确答案)

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

考题 该程序运行的结果是( )。#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");}

考题 C语言数组输出间隔 #include stdio.hvoid main(){ void sort(int array[],int n); int a[10],i; printf("enter the array:\n"); for(i=0;i10;i++) scanf("%d", sort(a,10); printf("The sorted array:\n"); for(i=0;i10;i++) printf("%d",a[i]); printf("\n");}void sort(int array[],int n){ int i,j,k,t; for(i=0;in-1;i++) { k=i; for(j=i+1;jn;j++) if(array[j]array[k]) k=j; t=array[k];array[k]=array[i];array[i]=t; }}程序呢,就是这个了。谭老爷子书上的例题,和书上一样,然后输入:5 7 -3 21 -43 67 321 33 51 0 然后从小到大排好后输出,书上他们之间从小到大有间隔,但是我运行了,没有间隔。。。。( ⊙o⊙ )?咋解决?????来高手解答。。。我运行后是:-43-305721335167321

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

考题 以下程序中函数sort的功能是对a所指数组中的数据进行由大到小的排序: float 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[3], 5); for(i=0; i<10; i++)printf("% d", aa[i]); printf ("\n"); } 程序运行后的输出结果是______。A.1, 2, 3, 4, 5, 6, 7, 8, 9, 10B.10, 9, 8, 7, 6, 5, 4, 3, 2, 1C.1, 2, 3, 8, 7, 6, 5, 4, 9, 10D.1, 2, 10, 9, 8, 7, 6, 5, 4, 3

考题 有以下程序: 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 sort(int a[] ,int n){int i,j,t; for(i=0;i 有以下程序: #include <stdio, h>void sort(int a[] ,int n){ int i,j,t; for(i=0;i<n;i ++ ) for(j =i+ 1;j<n;j ++ ) if(a[i]<a[j]){ t=a[1] ;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++) prinff("%d," ,aa[i]); prinff("\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,

考题 以下程序中,函数sort的功能是对a数组中的数据进行由大到小的排序。void sort(int a[],int n){ int i,j,t; for(i=0;in-1;i++) for(j=i+1;jn;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[3],5); for(i=0;i10;i++)printf("%d,",aa[i]); printf("\n");}程序运行后的输出结果是A.1,2,3,4,5,6,7,8,9,10B.10,9,8,7,6,5,4,3,2,1C.1,2,3,8,7,6,5,4,9,10D.1,2,10,9,8,7,6,5,4,3

考题 以下程序中函数sort的功能是对数组a中的数据进行由大到小的排序:includevoidsort(int 以下程序中函数sort的功能是对数组a中的数据进行由大到小的排序: #include<stdio.h> voidsort(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[]={1,2,3,4,5,6,7,8,9,10},i; son(aa[3],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.10,9,8,7,6,5,4,3,2,1,C.1,2,3;8,7,6,5,4,9,10,D.1,2,10,9,8,7,6,5,4,3,

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

考题 以下程序中函数sort的功能是对a所指数组中的数据进行由大到小的排序 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[3],5); for(i=0;i<10;i++)printf(“%d”,aa [i]); pfintf(“\n”); } 程序运行后的输出结果是A.1,2,3,4,5,6,7,8,9,10B.10,9,8:7,6,5,4,3,2,1C.1,2,3,8,7,6,5,4,9,10D.1,2,10,9,8,7,6,5,4,3

考题 以下程序中函数sort的功能足对a数组中的数据进行由大到小的排序 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[3],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 0,9,8,7,6,5,4,3,2,1,C.1,2,3,8,7,6,5,4,9,10,D.1,2,10,9,8,7,6,5,4,3,

考题 以下程序中函数sort的功能是对a所指数组中的数据进行由大到小的排序: void sort(int a[],int n) {int i,j,t; for(i=0;i<n-1;i++) for(j=i+1;i<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[3],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.10,9,8,7,6,5,4,3,2,1,C.1,2,3,8,7,6,5,4,9,10,D.1,2,10,9,8,7,6,5,4,3,

考题 有下列程序:void sort(int a[],int n){ int i,j,t;for(i=0;in-l;i++)for(j=i+1;jn;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;i10;i++)printf(%d,,aa[i]);printf(\n);}程序运行后的输出结果是( )。A.1,2,3,4,5,6,7,8,9,l0,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,

考题 有以下程序 vold soru(int a[], int n) { int i,i,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[i]; a[j]=t; } } main() { int aa[10]={1,2,3,4,5,6,7,8,9,10),i; sore(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 sort(int a[],int n){ int i,j,t; for(i=0;in-1;i+=2) for(j=i+2;jn;j+=2) 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,10); for(i=0;i10;i++) printf("%d,",aa[i]); printf("\n");}执行后的输出结果是A.1,2,3,4,5,6,7,8,9,10, B.10,9,8,7,6,5,4,3,2,1, C.9,2,7,4,5,6,3,8,1,10 D.1,10,3,8,5,6,7,4,9,2,

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

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

考题 以下程序中函数sort的功能足对a所指数组中的数据进行由大到小的排序 void sort(int a[],int n) { int i,j,t; for(i=0;i<n-1;i++) for(j=i+l,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[3],5); for(i=0;i<10;i++) print("%d, ",aa[i]); printf('\n"); } 程序运行后输出的结果是A.1,2,3,4,5,6,7,8,9,10B.10,9,8,7,6,5,4,3,2,1,C.1,2,3,8,7,6,5,4,9,10D.1,2,10,9,8,7,6,5,4,3,

考题 以下程序中函数sort的功能是对a数组中的数据进行由大到小的排序 void sort(int a[],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 aa[10]={1,2,3,4,5,6,7,8,9,10},i; sort(aa[3],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.10,9,8,7,6,5,4,3,2,1,C.1,2,3,8,7,6,5,4,9,10,D.1,2,10,9,8,7,6,5,4,3,

考题 以下程序中sort( )函数的功能是对a所指数组中的数据进行由大到小的排序: 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[3],5); for(i=0;i<10;++)printf("%d,",aa[i] ); printf("\n"); } 程序运行后的输出结果是A.1,2,3,4,5,6,7,8,9,10,B.10,9,8,7,6,5,4,3,2,1,C.1,2,3,8,7,6,5,4,9,10,D.1,2,10,9,8,7,6,5,4,3,

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

考题 有以下程序:includevoid sort(int a[],int n){int i,j,t; for(i=0;i 有以下程序: #include <stdio.h> void sort(int a[],int n) { int i,j,t; for(i=0;i<n-1;i+=2) for(j=i+2;j<n;j+=2) 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,10); for(i=0;i<10;i++) printf("%d.",aa[i]); printf("\n"); } 其输出结果是( )。A.1,2,3,4,5,6,7,8,9,10,B.10,9,8,7,6,5,4,3,2,1,C.9,2,7,4,5,6,3,8,1,10,D.1,10,3,8,5,6,7,4,9,2,

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

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