题目
下面程序的功能是统计字符串中"i"的个数,请填空。
Sub COU()
Dim n As Integer
a$=" Beijing University of Technology"
n=Len(a$)
For i=1 To n
b$=【 】
If b$="i" Then x=x+1
Next
Print"x=" ; x
End Sub
第1题
下面程序的功能是统计字符串中"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
第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题
下面这个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
第4题
下面程序的功能是统计字符串中“array”的个数,在程序的空白处应填入的正确选项是 public class FindKeyWords{ public static void main(String[]args) { String text="An array is a data structur that stores a collection of" +"values of the same type. You access each indMdual value" +"through an integer index. For example,if a is an array" +"of inergers,then a[i]is the ith integer in the array."; int arrayCount=0; int index=-1; String arrayStr="array"; index=text.indexOf(arrayStr); while(index>=0) { ++arrayCount; index+=arrayStr.length(); index=text.indexOf(arrayStr,index); } System.out.println("the text contains"+arrayCount+"arrays"); } }
A.<
B. =
C.<=
D.>=
第5题
A.将字符串s1拷贝给s
B.将字符串s拷贝给s1
C.统计字符串s1中有效字符个数
D.将字符串s1连接到s末尾
第6题
第7题
第8题
第9题
给定程序MODll.C中函数fun的功能是:统计字符串中各元音字母(即:A、E、I、O、U)的个数。注意:字母不分大、小写。
例如:若输入:THIs is aboot,则输出应该是:1、0、2、2、0。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构!
第10题
为了保护您的账号安全,请在“赏学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!