下面程序的功能是统计字符串中"i"的个数,请填空。
Sub COU()
a$="Beijing University of Technology"
Dim n As Integer
n=Len(a$)
For i=1 To n
b$= 【12】
If 【13】 Then x=x + 1
Next i
Print "x="; x
End Sub
第1题:
/**/charstr1[128];/**/
/**/sum++;/**/
第2题:
下面程序段的功能是将字符串s中所有的字符c删除,请填空()。 char s[80]; int i,j; gets(s); for(i=j=0;s[i]!='0';i++) if(s[i]!='c') (); s[j]='0'; puts(s);
第3题:
【填空题】下面程序以每行4个数的形式输出a数组,请分析程序填空。 #define N 20 main() { int a[N],i; for(i=0;i<N;i++) scanf("%d",【1】); for(i=0;i<N;i++) { if(【2】) 【3】; printf("%3d",a[i]); } }
第4题:
下面程序的功能是( )。 #include <iostream> #include <string> using namespace std; int main () { int i=1, n=0; char s[80],*p; p=s; strcpy(p,"It is a book.."); for (; *p !=' \0' ;p++) { if(*p=='') i=0; else if (i==0) { n++; i=1; } } cout<<"n=" <<n<<end1; return 0; }
A.统计字符串中的单词个数
B.统计字符串中的空格个数
C.统计字符串中的字母个数
D.统计字符串中的全部字符个数
第5题:
【填空题】下面程序的功能是在三个字符串中找出最小的。请分析程序填空。 #include <stdio.h> #include <string.h> main() {char s[20],str[3][20]; int i; for(i=0;i<3;i++) gets(str[i]); strcpy(s,【1】); if(strcmp(str[2],s)<0) strcpy(s,str[2]); printf("%sn",【2】); }