修改时间:2021-06-28 浏览次数:173 类型:高考模拟
编码 | 书名 | 作者 | 销售数量 | 销售日期 | 价格 |
A | 《量子力学》 | *** | 16 | 2021/5/1 | 25.5 |
B | 《人工智能》 | *** | 16 | 2021/5/1 | 36.5 |
... | ... | ... | ... | ... | ... |
A | 《量子力学》 | *** | 2 | 2021/5/1 | 25.5 |
下列关于“销售清单”数据表的描述,错误的是( )
n = Int(Rnd( ) * 4 + 4)
For i = 1 To 3
j = 1
Do While j <= n - i - 1
If a(j) > a(j + 1) Then
t = a(j):a(j) = a(j + 1):a(j + 1) = t
End If
j = j + 1
Loop
Next i
数组元素a(1)至a(7)的值依次为“16,35,18,11,23,17,32”,执行该程序段后,数组a各元素的值不可能的是( )
Key = Val(Text1.Text): i = 1: j = 10
Do While i <= j
m = (i + j + 1) \ 2
t(m) = 2
If Key <= a(m) Then
j = m - 1
Else
i = m + 1
End If
Loop
For i = 1 To 10
s = s + t(i)
Next i
数组元素t(1)至t(10)初值均为0,数组元素a(1)至a(10)的值依次为“4,7,9,11,16,19,22,24,28,29”,在文本框Text1中输入待查找数,执行该程序段后,下列选项中,s的值可能的是( )
图a
每本书对应一个唯一的书名编码,请回答下列问题:
(提示:SUMIF函数用于对区域中满足条件的单元格求和,例如:=SUMIF(B3:B9,B3,E3:E9),表示区域B3:B9中“书名”是“《量子力学》”的所有“小计”的和)
图b
图 a
图 b
Dim dd(0 To 100) As Integer '记录所有订单的取件距离
Dim fp(0 To 100) As Integer '存储第x个快递员取件的最远距离
Dim xs(0 To 100) As String
Private Sub Command1_Click()
Dim n As Integer,i As Integer,k As Integer,s As String
Dim left As Integer,right As Integer,m As Integer
Dim x As Integer,r As Integer
Randomize
s = Text1.Text: n = 1: i = 1
Do While i <= Len(s)
k = i: ch = Mid(s, k, 1)
Do While
k = k + 1: ch = Mid(s,k,1)
Loop
dd(n) = Val(Mid(s,i,k - i))
i = k + 1: n = n + 1
Loop
x = 1: fp(x) = dd(1)
For i = 2 To n - 1
left = 1
right = x
Do While left <= right
m = (left + right) \ 2
If Then
right = m - 1
Else
left = m + 1
End If
Loop
fp(r) = dd(i)
If r = x + 1 Then x = x + 1
Next i
Label2.Caption = "第" + Str(i - 1) + "件快递将由第" + Str(r) + "号快递员收取"
'列表框List1中显示每位快递员的收取情况,代码略
End Sub
图1
例如某天的销售清单,库存数据如图2所示,根据每本书的警戒1和警戒2库存,分组后的数据如图3所示。
图2
图3
Dim stock(1 To 52) As Integer '存储每本书警戒1和警戒2的库存数量
Dim num(1 To 100) As Integer '存储每本书每次的销售数量
Dim bm(1 to 26) As String '存储每本书的书名编码
Dim kc(1 To 26) As Integer '存储每本书的库存数量
Dim sell(1 To 26) As Integer,q(1 To 26) As Integer
Private Sub Form_Load()
'从数据库读取书目销售清单数据,显示在list1中,分别存在数组
'stock(1),stock(2)存书名编码A的警戒1库存,警戒2库存;stock(3),stock(4)存书名编码B的警戒1库存,警戒2库存,依次类推,代码略
End sub
Private Sub Command1_Click()
For i = 1 To 100 '处理100条销售清单数据
k = Asc(bm(i)) - 64
Next i
n = 0
For i = 1 To 26 '更新库存数据
If sell(i) > 0 Then
n = n + 1
kc(i) = kc(i) - sell(i)
End If
Next i
head = 0: tail = n + 1: j = 1
Do While j < tail
r = kc(q(j))
If r <= stock(2 * q(j) - 1) Then
head = head + 1
If Then t = q(head): q(head) = q(j): q(j) = t
j = j + 1
ElseIf r > stock(2 * q(j)) Then
tail = tail - 1
t = q(j): q(j) = q(tail): q(tail) = t
Else
j = j + 1
End If
Loop
'分组排序及排序后数据显示在列表框list2中,代码略
End Sub
试题篮