有以下程序
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=i+1;j<p->n;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)1,2,3,4,5,6,7,8,9,10,
B)10,9,8,7,6,5,4,3,2,1,
C)2,3,1,6,8,7,5,4,10,9,
D)10,9,8,7,6,1,2,3,4,5,
有以下程序
struct S{ int n; int a[20]; };
void f(int *a,int n)
{ int i;
for(i=0;i<n-1;i++) a[i]+=i;
}
main( )
{ int i; struct S s={10,{2,3,1,6,8,7,5,4,10,9}};
f(s.a,s.n);
for(i=0;i<s.n;i++) printf("%d",s.a[i]);
}
程序运行后的输出结果是
A)2,4,3,9,12,12,11,11,18,9,
B)3,4,2,7,9,8,6,5,11,10,
C)2,3,1,6,8,7,5,4,10,9,
D)1,2,3,6,8,7,5,4,10,9,
有以下程序
#include <stdio.h>
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;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,
有以下程序
struct S {int n; int a[20];}; void f(struct S *P) {int i,j,t; for(i=0;in-1;i++) for(j=i+1;jn;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 printf(“%d”,s.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.2,3,1,6,8,7,5,4,10,9,
D.10,9,8,7,6,1,2,3,4,5,
有以下程序 struct S{ int n;int a[20];}; voidf(struct S*p) { int i,j,t; for(i=0;i<p->n-1;i++) for(j=i+1;j<p->n;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,l,6,8,7,5,4,10,9}}; f(&s); for(i=0;i<s.n;i++)printf("%d,",s.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.2,3,1,6,8,7,5,4,10,9,
D.10,9,8,7,6,1,2,3,4,5,
成人教育学位英语【完形填空】练习和答案详解( 1) ( 1) am by 纹,线条 ) of by of _1_ 状物 ) of I a _2_ _3_ my I _4_ of _5_ of my s 刺的 ), _6_ is t _7_ to be m I _8_ at _9_ of or of _10_. m on 失 ). _11_ of on is _12_ s 稳定的 ) _13_ of I _14_ to on I _15_ on a _16_ in of It me me a _17_ to in an _18_ 实上 ) no is a to _19_. I m 安的 ), _20_ am or m in I 1. A. B. C. . A. B. C. . A. B. C. . A. B. C. . A. B. C. . A. B. C.
有以下程序: 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所指数组中的数据进行由大到小的排序: 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, 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
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,
有下列程序: #include<stdi0.h> voidfun(inta,intb) {intt; t=a;a=b;b=t; voidmain( ) {intc[1O]={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
有以下程序 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,