有以下程序#ncludestdio.h#includestring.hmain(){ char a[5][10]={"china","beijing","you","tiananmen","welcome"};int i,j;char t[10];for(i=0;i4;i++)for(j=i+1;j5;j++)if(strcmp(a[i],a[j])0){strcpy(t,a[i]);strcpy(a[i],a[j]);strcpy(a[j],t);}puts(a[3]);}程序运行后的输出结果是A.beijingB.chinaC.welcomeD.tiananmen
有以下程序
#nclude<stdio.h>
#include<string.h>
main()
{ char a[5][10]={"china","beijing","you","tiananmen","welcome"};
int i,j;char t[10];
for(i=0;i<4;i++)
for(j=i+1;j<5;j++)
if(strcmp(a[i],a[j])>0)
{strcpy(t,a[i]);strcpy(a[i],a[j]);strcpy(a[j],t);}
puts(a[3]);
}
程序运行后的输出结果是
A.beijing
B.china
C.welcome
D.tiananmen
相关考题:
下面程序的输出结果是( )。 include main() {static char a[]="china"; char*ptr=a; whi 下面程序的输出结果是( )。 include<stdio.h> main() {static char a[]="china"; char*ptr=a; while(*ptr) {printf("%c",*ptr-32); ptr++; } }
有以下程序 main(){ char str [] [10]={"China", Beijing"},*p=str; printf("%s\n",p+10);} 程序运行后的输出结果是A.ChinaB.BeijingC.ngD.ing
有以下程序: main() { char str[][10]={"China","Beijing"),*P=str; printf("%s\n",p+10); } 程序运行后的输出结果是 ______。A.ChinaB.BeijingC.ngD.ing
有以下程序:includemain(){FILE *pf;char*s1="China",*s2="Beijing":pf=fopen("abc.da 有以下程序: #include<stdio.h> main() {FILE *pf; char*s1="China",*s2="Beijing": pf=fopen("abc.dat","wb+"); fwrite(s2,7,1,pf); rewind(pf); /*文件位置指针回到文件开头*/ fwrite(s1,5,1,pf); fclose(pf); } 以上程序执行后abc.dat文件的内容是( )。A.ChinaB.ChinangC.ChinaBeijingD.BeijingChina
有以下程序main( ){char str[ ][10]={"China","Beijing"},*p=str;printf("%s\n",p+10);}程序运行后的输出结果是A.ChinaB.BejingC.ngD.ing
有以下程序 include main() { FILE*pf, char *s1="China", 有以下程序 #include <stdio.h> main() { FILE*pf, char *s1="China",*s2="Beijing"; pf=fopen("abc.dat","wb+"); fwrite(s2,7,1,pf); rewind(pf); /*文件位置指针回到文件开头*/ fwrite(s1,5,1,pf); fclose(pf); } 以上程序执行后abc.dat文件的内容是______。A.ChinaB.ChinangC.ChinaBeijingD.BeijingChina
有以下程序:include main( ){ehar str[ ] [10] = { "China" ," Beijing" } , * p = 有以下程序: #include < stdio. h > main( ) { ehar str[ ] [10] = { "China" ," Beijing" } , * p = str[o]; printf( "% s \n", p + 10); }程序运行后的输出结果是( )。A.ChinaB.BeijingC.ngD.ing
有以下程序: main() { char str[][10]={"China","Beijing"),*p=str; printf("%s\n",p+10); } 程序运行后的输出结果是( )。A.ChinaB.BeijngC.ngD.ing
有以下程序:include include main(){char *p[10]={"abc","aabdfg","dcdbe" 有以下程序: #include <stdio.h> #include <string.h> main() { char *p[10]={"abc","aabdfg","dcdbe","abbd","cd"}; printf("%d\n",strlen(p[4])); } 执行后的输出结果是( )。A.2B.3C.4D.5
【单选题】以下四种说法中,正确的是________。(第7章 指针程序设计)A.char *a="china"; 等价于 char *a; *a="china";B.char str[]={"china"}; 等价于 char str[10]; str[]={"china"};C.char *s="china"; 等价于char *s; s="china";D.char a[4]="abc",b[4]="abc"; 等价于 char a[4]=b[4]="abc";