①K歌软件对演唱者的表演进行智能打分
②某支付APP支持的人脸识别付款方式
③Word软件自动识别输入的拼写和语法错误
④将学生的答卷扫描之后,教师进行网络阅卷
⑤某购物网站提供的拍照搜索商品功能
Private Sub Text1_Change()
Dim c As Integer, i As Integer
i=0
c = Val(Text1.Text)
Do While c >= 0
c = c - i
i = i + 1
Loop
Text1.Text = Str(c)
End Sub
在文本框输入“6”,执行该程序段后, 其中c >= 0执行的次数是( )
s = 1/2 + 2/3 : t = 1: b = 2
For i= 3 To 10
Next i
Label1.Caption = "前10项的和是:" + Str(s)
方框中的代码由以下四部分组成:
①b = r ②t = b ③r = t + b ④s = s + r/(r + b)
代码顺序正确的选项是( )
Dim a(1 To 10) As Integer, b(5 To 10) As Integer
a(1) = 71: a(2) = 73: a(3) = 90: a(4) = 79: a(5) = 76
a(6) = 88: a(7) = 91: a(8) = 84: a(9) = 100: a(10) = 80
For i = 10 To 1 Step -1
b((a(i) - 1) \ 10) = b((a(i) - 1) \ 10) + 1
Next i
该程序段运行后,数组元素b(7)的值是( )
Private Sub Command1_Click()
Dim s As String, a As String, t As String
s = Text1.Text: t = ""
For i = 1 To Len(s)
a = Mid(s, i, 1)
If a >= "0" And a <= "9" Then
t = t + a
ElseIf a = "!" Then
t = ""
ElseIf t <> "" Then
List1.AddItem t
End If
Next i
End Sub
在文本框Text1中输入“12+23=35!456Ye”,单击按钮“Command1”后,在列表框List1中显示的结果是( )
图 a
(提示:AVERAGEIF 函数用于返回某个区域内满足给定条件的所有单元格的平均值。例如:=AVERAGEIF(A4:A23,"水果",D4:D23)用于计算1月份所有水果的平均价格。
图b
实现上述功能的VB程序如下:
Private Sub Command1_Click()
List1.Clear
Dim five(1 To 5) As Integer
Dim i As Integer, j As Integer, k As Integer
Dim p As Integer, find_pair As Boolean
'随机抽取5张牌,将牌的点数存储在数组five中,并在List1中显示。代码略
i = 5: p = 1: find_pair = False
Do While i>= 2
j=p
Do While j <= i - 1
If five(j) > five(j + 1) Then
t = five(j): five(j) = five(j + 1): five(j + 1) = t
ElseIf five(j) = five(j + 1) And Not find_pair Then
t = five(1): five(1) = five(j): five(j) = t
t = five(2): five(2) = five(j + 1): five(j + 1) = t
find_pair = True
i = i + 1
p = _____________
Exit Do
End If
j = j + 1
Loop
i = i - 1
Loop
k = 0
For i = 3 To 4
If Then k = k + 1
Next i
If five(1) = five(2) And k = 2 Then
Label1.Caption = "运气不错:)"
Else
Label1.Caption = "运气一般:|"
End If
End Sub
请回答下列问题:
N阶幻方的构造方法有很多种,下面是“右上方填数法”的算法:
⑴将1放在第一行中间一列;
⑵2~n2依次填在上一个数的右上方位置(即行减1列加1):
若上一个数的行数为1时,则当前数的行数为n;
若上一个数的列数为n时,则当前数的列数为1。
⑶如果按上面规则确定的位置上已有数,则把当前数放在上一个数的下面。
例如当n为3时,如图a所示,1在第1行第2列,则2的位置为第3行第3列;
再如3在第2行第1列,则4的位置应为第1行第2列,但该位置已有数,因此4就放在3所在位置的正下面。
“左上方填数法”的方法类似于“右上方填数法”,以3阶幻方为例,“右上方填数法”和“左上方填数法”所构造的幻方如下图a、图b所示。
|
|
图a 右上方填数法 | 图b 左上方填数法 |
小明采用“左上方填数法”的方法设计了如下程序。
Private Sub Command1_Click()
Dim a(1 To 100) As Integer
Dimx As Integer,y As Integer,x1 As Integer,y1 As Integer
Dim n As Integer, s As Integer,pos As Integer, st As String
n = Val(Text1.Text)
For i = 1 To n * n
a(i) = 0
Next i
s = 1
x = 1
y = (n + 1) \ 2
a(y) = s
Do While ①
s = s + 1
x1 = x: y1 = y
x = x - 1
y = y - 1
If x < 1 Then x = n
If y < 1 Then y = n
If a((x - 1) * n + y) > 0 Then ② : y = y1
③
a(pos) = s
Loop
st = ""
For i = 1 To n * n
st = st + wid(a(i))
If i Mod n = 0 Then
List1.AddItem st
st = ""
End If
Next i
End Sub
'自定义函数wid的功能是使数字在方阵对齐
Function wid(p As Integer) As String
'代码省略
End Function
请回答下列问题:
① ② ③