题型:综合题 题类:常考题 难易度:困难
浙江省杭州市2016年信息技术高考模拟卷一
Dim ID( ) As String '用于存放客户卡号
Dim total( ) As Long '用于存放积分数
Dim sc As Long 'VIP客户人数
Dim jf As Long '积分数
Private Sub Command1Click( )
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
’ ②
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
ElseIf jf > 150000 Then
Cash = jf\2000*14
End If
End Function
Private Sub FormLoad()
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
试题篮