18、下面程序段是输出两个字符串中对应字符相等的字符。请选择填空。char x[]="programming";char y[]="Fortran";int i=0;while(x[i]!='\0' && y[i]!='\0'){if(x[i]==y[i])printf("%c",【 】);elsei++;}A)
A. x[i++]
B. y[++i]
C. x[i]
D. y[i]
查看答案
19、下列程序段的输出结果是main(){char b[]="Hello,you";b[5]=0;printf("%s \n", b );}A)
A. Hello
B. Hello,you
C. Hell
D. Hello,
20、当执行下面的程序时,如果输入ABC,则输出结果是#include "stdio.h"#include "string.h"main(){char ss[10]="1,2,3,4,5";gets(ss);strcat(ss, "6789");printf("%s\n",ss);}
ABC6789
B. ABC67
C. 12345ABC6
D. ABC456789
21、下面程序的运行结果是#includemain(){char ch[7]={"12ab56"};int i,s=0;for(i=0;ch[i]>='0'&&ch[i]<='9';i+=2)s=10*s+ch[i]-'0';printf("%d",s);}
A. 15
B. 1256
C. 12ab56
D. 1
22、当运行以下程序时,#includemain(){char a1[5],a2[5」,a3[5];scanf("%s%s",a1,a2);gets(a3);puts(al);puts(a2);puts(a3);}从键盘输入:aa bb cc dd(表示回车),则下面程序的运行结果是
A. aabbcc dd
B. aabbccdd
C. aa bbcc dd
D. aa bbccdd