下面这个Sub过程的功能是统计字符串中“a”的个数,请在空白处填上合适的代码完成程序。
Private Sub numCount()
Dim hum As Integer
s$ = "software And hardware"
num = Len(s$)
For i = 1 To hum
b$=______
If b$ = "a" Then x = x+1
Next i
Print "x="; x
End Sub
第1题:
以下程序的功能是统计字符串A中出现字符串B的次数,然后输出,请在填空[9]处填入适当的程序完成功能。
第2题:
下面程序的功能是( )。 #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.统计字符串中的全部字符个数
第3题:
以下方法的功能是统计字符串中数字字符的个数。请在空白处填入适当内容,把程序补充完整。 static int count(string s) { int r=0; for(int i=0;i<s.Length;i++) { if(_______) __r++___; } return r; }
第4题:
下列程序的功能是统计字符串中“array”的个数,在程序的空白处应填入的正确选项是( )。

A.<
B.=
C.<=
D.>=
第5题:
( 11 )下列程序的功能是统计命令行参数的个数,请在下划线处填上适当的代码。
public class Length{
public static void main(String args[]){
System.out.println( " number of String args: " +args. 【 11 】 );
}
}