修改时间:2024-07-12 浏览次数:211 类型:高考模拟
Private Sub Command1_Click( )
Dim a As Single, b As Single,s As Single,g As Single
a = Val(Text1.Text)
b = Val(Text2.Text)
s = Val(Text3.Text)
Label5.Caption =
End Sub
图1
请回答下列问题:
图2
请根据算法将下列程序补充完整。
Function prime(a As Integer) As Boolean
Dim j As Integer
prime = True
j = 2
Do While prime And j <= a \ 2
If a Mod j = 0 Then
prime = False
Exit Do
End If
Loop
End Function
Private Sub Command1_Click( )
Dim i As Integer, a As Integer, b As Integer
Dim count As Integer
a = Val(Text1.Text)
b = Val(Text2.Text)
For i = a To b
If = True Then
List1.AddItem Str(i)
count = count + 1
End If
Next i
Label1.Caption = "素数共有" + Str(count) + "个!"
End Sub
Dim ID( ) As String '用于存放客户卡号
Dim total( ) As Long '用于存放积分数
Dim sc As Long 'VIP客户人数
Dim jf As Long '积分数
Private Sub Command1_Click( )
Dim k As String '客户卡号
Dim q As Long '代金券额度
Dim i As Long
k = Text1.Text
For i = 1 To sc ’顺序查找
If ID(i) = k Then
jf = total(i)
cash(jf) = q ’ ①
Exit For
End If
Text2.Text = Str(jf)
Label3.Caption = “您可换购的代金券总额为:”+ Str(q) + “元”
Next i
End If
End Sub
' cash函数用于计算VIP客户可换购的代金券额度
Function cash(jf As Long) As Long
If jf >= 2000 And jf <= 20000 Then
Cash = jf\2000*10
ElseIf jf > 20000 And jf <= 50000 Then
Cash = jf\2000*11
ElseIf jf > 50000 And jf <= 100000 Then
Cash = jf\2000*12
ElseIf jf > 100000 And jf <= 150000 Then
Cash = jf\2000*13
Else jf > 150000 Then ’ ②
Cash = jf\2000*14
End If
End Function
Private Sub Form_Load()
Dim conn As New ADODB.Connection, rs As New ADODB.Recordset
Dim intSQL As Long
conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + App.Path + "\ customer.accdb"
conn.Open
intSQL = "SELECT score FROM Integral"
Set rs.ActiveConnection = conn
rs.CursorType = adOpenStatic
rs.Open intSQL
sc = 0
Do While Not rs.EOF
sc = sc + 1
total(sc) = rs.Fields("score")
rs.MoveNext
Loop
rs.Close
conn.Close
Set rs = Nothing
Set conn = Nothing
End Sub
试题篮