姓名 | 班级 | 学号 | 书名. | 作者 | 出版社 | 借阅时间 | 图书状态 |
肖战 | 101 | 20210101 | 呐喊 | 鲁迅 | 现代出版社 | 2022/3/10 | 在借 |
朱一龙 | 206 | 20200262 | 围城 | 钱钟书 | 铁道出版社 | 2021.9.30 | 已还 |
白敬亭 | 103 | 20210316 | 雷雨 | 曹禺 | 现代出版社 | 2022-1-10 | 逾期 |
下列关于“借阅信息"数据表的描述,不正确的是( )
k=0
For i=0 To 63
n =0
For j=1 To 6
Next j
If n=3 Then k=k+1
Next i
Text1.Text=“符合要求的数字串有”+ Str(k) + “个”
上述程序段中方框处可选语句为:①d=d\2 ②d=I ③n =n+dMod2
则(1) (2) (3)处语句依次可为( )
s ="wantsfood"
t = Mid(s, Len(s), 1)
max=0
For i=Len(s)-1 To 1 Step-1
If Mid(s, i + 1, 1) >= Mid(s,i, 1) Then
t = Mid(s, i,1) + t
If Len(t) >= max Then max = Len(t): ans= t
Else
t = Mid(s, i, 1)
End If
Next i
执行该程序段后,变量ans和max的值分别是( )
i =1:j=10: key = 88
Do While I <=j
m=(i+j)\2
If key < a(m) Then j = m-1 Else i=m+1
Loop
数组元素a(1)到a(10)的值依次为“12,15,18,20,25,39,47,88,90,99”,经过上述代码查找后,下列表达式正确的是( )
编写VB程序,实现上述功能。运行程序,在列表框List1中显示每笔交易流水记录的商品货号与销售金额,单击“分析”按钮Command1,汇总同类商品的销售额并在列表框List2中显示销售额前3名的商品货号与销售金额。程序运行界面如图所示。
(单选,填字母: A .类名/B .属性名/C .方法名/D .事件名)
'n是交易流水的记录总数,ng是商品种类,代码略
Dim goods(1 To n) As String '每笔交易的商品货号
Dim money(1 To n) As Single '每笔交易的销售金额
Dim g(1 To ng) As String
Dim c(1 To ng) As Single
Private Sub Form_ Load ()
'读取每笔交易流水,分别将商品货号存入数组goods、销售金额存入数组money
'g(1)~g (ng)分别存储ng种商品的货号,在List1中显示交易记录信息,代码略
End Sub
Private Sub Command1_Click ()
Dim i As Integer, j As Integer, tc As Single, tg As String
For i=1 To n
For j=1 To ng
If goods(i) = g(j) Then
Next j
Next i
i =1
Do While i <= ng
Fo rj=ng To i+1 Step-1
If c(j)>c(j-1) Then
tc=c(j) : c(j)=c(j-1) : c(j-1)=tc
tg=g(j) : g(j)=g(j-1) : g(j-1)=tg
End If
Next j
If Then Exit Do
i =i+1
Loop
For j=1 To
List2.AddItem g(j) +“”+ Str(c(j))
Next i
End Sub
根据上述要求编写VB程序,功能如下:读取某天上午办理业务的num个客户信息(已按到达时间顺序排列),显示在列表框List1中。程序运行时,在文本框Text1中输入可同时办理业务的窗口数量m,单击“输出”按钮Command1,在列表框List2中输出客户平均等待时间、等待时间最长的客户编号及其等待时间。程序运行界面如第16题图所示。
请回答下列问题:
Const n = 300
Dim no(1 To n) As String, st(1 To n) As String, ti(1 To n) As Integer
Dim num As Integer 'num为待办理业务总人数
Private Sub Form_ load ()
'从数据库中读取所有客户编号、到达时间和办理业务所需要时间等信息,分别保存在
'数组no、st和ti中,统计总人数num,并在列表框List1中显示客户信息,代码略。
End Sub
Function t2d(x As String) As Integer
'将时间转化成从0点开始的时长(单位:分钟)来表示,例如8:18用498来表示;
'代码略
End Function
Private Sub Command1_ Click ()
Dim max_ no As String,max_ wait As Integer
Dim wait_ sum As Integer, wait_ time As Integer, wait_ num As Integer
Dim m As Integer, k As Integer, t As Integer
Dim w(1 To 10) As Integer '数组w存储窗口办理业务结束的时间(从0点开始的时长)
Dim i As Integer, p As Integer, q As Integer
m = Val (Text1. Text)
wait_ sum = 0
wait_ num = 0
max_ wait = 0
max_ no =""
k=0
For i=1 To m
w(i) = 0
Next i
For i=1 To num
If Then '当前办理业务不需要等待
t = t2d(st(i)) + ti(i)
Else
wait_ num = wait_ num + 1
wait_ time = w(1) - t2d(st (i))
wait_ sum = wait_ sum + wait_ time
If wait_ time > max_ wait Then
max_ wait = wait_ time
max_ no = no(i)
End If
End If
p =1
Do While w(p)<t And p<=k
p=p+1
Loop
If k<m Then '当前办理业务不需要等待
q=k
Do While q > = p
w(q+1)=w(q)
q=q-1
Loop
w(p) = t
k=k+1
Else
q=1
Do While q< p -1
q=q+1
Loop
w(q) = t
End If
Next i
List2. AddItem "平均等待时间:"+Str (Int (wait_ _sum/wait_ _num*10+0. 5)/10)+*分钟"
List2. AddItem "等待时间最长的是:"+max_ no+"号, 等待了"+Str (max_ wait)+^ 分钟"
End Sub