①使用红外测温枪,不接触就能测量体温
②使用翻译笔直接将普通话翻译成英语
③某网站将用户上传的视频进行压缩转码后输出
④通过人脸识别,直接获取“绿码”信息
下列说法正确的是( )
①Str(7 mod 2);
②Str(Abs(Int(-2.3))-2);
③Mid(“嘉兴0123”,3,1)+“1”;
④Str(5\6/2)
For i = 1 To 2
k = i
For j = i + 1 To 7
If a(j) < a(k) Then k = j
Next j
If i <> k Then
t = a(i) : a(i) = a(k) : a(k) = t
End If
Next i
数组元素a(1)到a(7)的值依次为“19,85,86,90,24,22,62”,经过该程序段“加工”后,数组元素a(1)到a(7)的值依次为( )
Function fun(x As Integer) As Integer
If x <= 2 Then
fun = x
Else
fun = 2 * fun(x - 1) + fun(x - 2)
End If
End Function
则表达式fun(5)的值为( )
Dim left As Integer, right As Integer, n As Integer, x As Integer
n = Val(Text1.Text)
left = 1: right = n
Do While ①
x = (left + right) \ 2
If 2 ^ x + 3 * x - 5 <= n Then
left = x + 1
Else
right = x - 1
End If
Loop
Label1.Caption = "方程2^x+3*x-5<=n的最大正整数解为:" + Str( ② )
为实现程序功能,①②处代码应为( )
图b
图c
场景名:主界面 |
序号类别:2 |
进入方式:来自“片头”场景,通过“开始”按钮进入 |
呈现方式: ⒈“垃圾”文字从舞台左上侧飞入,最终停在舞台中央(偏左)。 ⒉“分类”文字从舞台上侧飞入,旋转一圈后静止在“垃圾”右侧。 …… |
呈现顺序: ⒈一开始出现城市背景,“垃圾”文字从舞台左上侧飞入,补间动画持续1秒,静止在舞台中央(偏左)。 ⒉动画开始1秒后,“分类”文字从舞台上侧飞入,补间动画持续1秒,静止在舞台中央(偏右)。 …… |
Const n = 10
Dim a(1 To n) As Integer
Private Sub Form_Load()
For i = 1 To n
a(i) = ‘产生两位随机正整数
List1.AddItem Str(a(i))
Next i
End Sub
Private Sub Command1_Click()
Dim p As Integer, q As Integer, pos1 As Integer, pos2 As Integer, t As Integer
p = 1: q = n
Do While
If a(p) <= a(p + 1) Then
pos1 = p: pos2 = p + 1
Else
pos1 = p + 1: pos2 = p
End If
For i = p To q
If a(i) < a(pos1) Then
pos2 = pos1
pos1 = i
ElseIf a(i) < a(pos2) Then
pos2 = i
End If
Next i
If pos1 <> p Then t = a(pos1): a(pos1) = a(p): a(p) = t
If pos2 = p Then
If pos2 <> q Then t = a(pos2): a(pos2) = a(q): a(q) = t
p = p + 1: q = q - 1
Loop
For i = 1 To n
List2.AddItem Str(a(i))
Next i
End Sub
在寻找等价货币系统时,小美发现了如下规律:
1)与给定货币系统等价的货币系统必定是该货币系统的子集;
2)如果货币系统中的某个面额可以被其他货币表示时,该面额是无效的;
为此,小美按照如下方法构造最小等价货币系统B:先将原货币系统A的所有面额升序排序,每次把A中可以被B中的货币表示的面额删去后,将A中的最小面额放入B中。以此类推。基于此方法,小美编写了如下程序,在文本框Text1中输入给定的货币系统,单击按钮Command1后,在标签Label1中输出与其等价的货币系统的最小面额种数,在标签Label2中输出该货币系统。程序运行界面如图所示。
Private Sub Command1_Click()
Dim s As String, tmp As String, c As String
Dim n As Integer, i As Integer, j As Integer, ans As Integer
Dim a(1 To 100) As Integer, b(1 To 10000) As Boolean
'数组b(i)用于表示值i能否用已经放入新货币系统中的面额来表示
'此段程序用于将给定货币系统存储在a数组中并将其元素个数存储在变量n中
s = Text1.Text
tmp = "": n = 0
For i = 1 To Len(s)
c = Mid(s, i, 1)
If c >= "0" And c <= "9" Then
ElseIf tmp <> "" Then
n = n + 1
a(n) = Val(tmp)
tmp = ""
End If
Next i
For i = 1 To n - 1
For j = n To i + 1 Step -1
If Then
t = a(j): a(j) = a(j - 1): a(j - 1) = t
End If
Next j
Next i
ans = 0: s = "{"
For i = 1 To a(n)
b(i) = False
Next i
For i = 1 To n
If Not b(a(i)) Then
ans = ans + 1
If ans <> 1 Then s = s + ","
s = s + CStr(a(i)) 'Cstr函数用于将数值变量转为字符串变量并去除首位空格
For j = a(i) + 1 To a(n)
If b(j - a(i))= True Then b(j) = True
Next j
End If
Next i
s = s + "}"
Label1.Caption = "与之等价的最小货币系统面额种数为" + Str(ans)
Label2.Caption = "其为" + s
End Sub