网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
单选题
有以下函数:#include void exch(int t[]){ t[0] = t[5];}main(){ int x[10] = {1,2,3,4,5,6,7,8,9,10},i=0; while(i <= 4) { exch(&x[i]); i++; } for(i = 0;i < 5;i++)printf(%d,x[i]);}程序运行后的输出结果是( )。
A
2 4 6 8 10
B
1 3 5 7 9
C
1 2 3 4 5
D
6 7 8 9 10
参考答案
参考解析
解析:
函数exch的作用就是把数组某个元素的值变为这个元素位置加5后对应的元素值,所以执行完之后输出数组x的前五个元素的值,其实就是数组x的后五个元素的值,答案选择D选项。
函数exch的作用就是把数组某个元素的值变为这个元素位置加5后对应的元素值,所以执行完之后输出数组x的前五个元素的值,其实就是数组x的后五个元素的值,答案选择D选项。
更多 “单选题有以下函数:#include void exch(int t[]){ t[0] = t[5];}main(){ int x[10] = {1,2,3,4,5,6,7,8,9,10},i=0; while(i = 4) { exch(x[i]); i++; } for(i = 0;i 5;i++)printf(%d,x[i]);}程序运行后的输出结果是( )。A 2 4 6 8 10B 1 3 5 7 9C 1 2 3 4 5D 6 7 8 9 10” 相关考题
考题
有以下程序#include stdio.hvoid fun( int a, int b){ int t;t=a; a=b; b=t;}main(){ int c[10]={1,2,3,4,5,6,7,8,9,0},i;for(i=0;i10;i+=2) fun(c[i], c[i+1]);for(i=0;i10;i++) printf("%d," ,c[i]);printf("\n");}程序的运行结果是A)1,2,3,4,5,6,7,8,9,0,B)2,1,4,3,6,5,8,7,0,9,C)0,9,8,7,6,5,4,3,2,1,D)0,1,2,3,4,5,6,7,8,9,
考题
有以下程序#include stdio.h#define N 4void fun(int a[][N], int b[]){ int i;for(i=0;iN;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;iN;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,
考题
有以下程序:void f(int *x,int *y){ int *t; t=x; x=y ;y=t; *x=*y;}main(){ int a[8]={1,2,3,4,5,6,7,8},i,*p,*q; p=a;q=a[7]; while(pq) { f(p,q);p++;q--} for(i=0;i8;i++)printf("d,",a[i]);}程序运行后的输出结果是( )。A.8,2,3,4,5,6,7,1,B.5,6,7,8,1,2,3,4,C.1,2,3,4,5,6,7,8,D.8,7,6,5,4,3,2,1,
考题
有以下程序: 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 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,
考题
有以下程序: 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,
考题
以下程序中,函数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
考题
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,
考题
有以下程序 include void fun(int a, int b) {int t; t=a; a=b;
有以下程序 #include<stdio.h> void fun(int a, int b) {int t; t=a; a=b; } int c[10]={1,2,3,4,5,6,7,8,9,0},i; for(i=0;i<10;i+=2) fun(c[i],c[i+1]); for(i=0;i<10;i++) printf("%d,",c[i]); printf("\n"); } 程序的运行结果是______。A.1,2,3,4,5,6.7,8,9,0,B.2,1.4.3.6,5.8,7,0,9,C.0,9,8,7,6,5,4,3,2,1,D.0,1,2,3,4,5,6,7,8,9,
考题
有以下程序 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 reverse(int a[ ] ,int n) { int i,t;for(i=0
以下程序的输出结果是#include<iostream.h>void reverse(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;}}void main( ){ int b[10] ={1,2,3,4,5,6,7,8,9,10};int i,s=0;reverse(b,8) ;for(i=6;i<10;i++) s+=b[i] ;cout < < S;}A.22B.10C.34D.30
考题
有以下程序#include stdio.hvoid exch(int t[ ]){ t[0]=t[5]; }main( ){ int x[10]={1,2,3,4,5,6,7,8,9,10),i=0;while(i=4){ exch(x[i]); i++; }for( i=0; 15;i++) printf(”%d",x[i]);.printf( "\n");}程序运行后输出的结果是A) 2 4 6 8 10B) 1 3 5 7 9C) 1 2 3 4 5D) 6 7 8 9 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,
考题
以下程序中函数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,
考题
以下程序的输出结果是()。includevoid reverse(int a [],int n){int i,t; for(i=0;i
以下程序的输出结果是( )。 #include <stdio.h> void reverse(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 b[10]={1,2,3,4,5,6,7,8,9,10};int i,s=0; reverse(b,8); for(i=6;i<10;i++)s+=b[i]; printf("%d\n",s); }A.22B.10C.34D.30
考题
有下列程序: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,
考题
有以下程序: 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,
考题
有以下程序: #includestdio.h void exch(int t[]) { t[0]=t[s];} main( ) { int x[10]={1,2,3,4,5,6,7,8,9,10},i=0; while(i=4){exch(x[i]);i++;} for(i=0;i5;i++)printf("%dl"x[i]); printf("\n"); } 程序运行后输出的结果是( )。A.2 4 6 8 10B.1 3 5 7 9C.1 2 3 4 5D.6 7 8 9 10
考题
以下程序中函数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;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,
考题
有以下程序: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 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,
考题
单选题有以下程序:#include void fun(int a,int b){ int t; t=a; a=b; b=t;}main(){ int c[10]={1,2,3,4,5,6,7,8,9,0},i; for(i=0;i10;i+=2)fun(c[i],c[i+1]); for(i=0;i10;i++)printf(%d,,c[i]); printf();}程序运行的结果是( )。A
1,2,3,4,5,6,7,8,9,0,B
2,1,4,3,6,5,8,7,0,9,C
0,9,8,7,6,5,4,3,2,1,D
0,1,2,3,4,5,6,7,8,9,
热门标签
最新试卷