序号 | 姓名 | 身份证号 | 进校时间 | 体温 | 是否来自高风险地区 |
1 | 张三 | 330621198806544412 | 2020-12-19 8:23:18 | 36.8 | 否 |
2 | 李四 | 330891200202243965 | 2020-12-25 15:25:55 | 36.9 | 否 |
… | … | … | … | … | … |
对应的表结构设计最合理的是( )
Const mw = "0123456789"
S = Text1.Text: s1 = "":s2 = ""
For i=1 To Len(s)
C = Mid(s,i,1)
If c >= "0" And c <= "9" Then
s1 = s1 + c
ElseIf c = "-" Then
s2 = s2 + s1 + c
s1 = ""
Else
End If
Next i
① t =(Val(c)+5) Mod 10
② c = Mid(mw,t,1)
③ s1 = c + s1
④ t=(Val(c)+4) Mod 10+1
⑤ c= Mid(mw,t+1,1)
⑥ s1 = s1 + c
则填空处的代码应该是( )
For i = 1 To 6
a(i)= Int(Rnd*6)+ 1
Next i
For i = 1 To 6
b(a(i))= b(a(i))+ 1
Next i
c(1)= 1
For i = 2 To 6
c(i)= c(i - 1)+ b(i - 1)
Next i
数组b各元素的初值均为0,执行该程序后,则数组c各元素的值不可能是( )
(单选,填字母:A . 0.00 / B . #VALUE! / C . #DIV/0!)
下列说法正确的是_______________(多选,填字母)。
Private Sub Command1_Click( )
Dim s As String, t As String, n As Integer
Dim i As Integer, m As Integer
s = Text1.Text
n = Len(s)
For i = 1 To n
t = Mid(s,i,1)
If t >= "A" And t <= "Z" Then
m = ①
ElseIf t >= "a" And t <= "z" Then
m= m + Asc(t)- 96 ‘Asc(t)用于返回字符t的ASCII 码值
End If
Next i
For i = 2 To m - 1
If Then Exit For
Next i
If ② Then
Label1.Caption = "It is a prime word."
Else
Label1.Caption = "It is not a prime word."
End If
End Sub
① ②
原字符串8个字符为一段,分成若干段进行重排处理,尾段剩余字符(个数小于8)为独立段不做处理。
重排规则:从起始段第1个字符开始,从1开始数数,数到m时取出该位置上的字符,拼接到新字符串。然后,从下一个位置继续从1开始数数,数到m时再次取出相应位置上的字符,拼接到新字符串。当数到每段的最后一个字符时,重新从该段首第一个没有取掉的字符继续数数。重复上述操作,直至段内8个字符被取完。注:当某段中的7个字符被取出后,该段最后一个字符不需要数数,直接取出拼接到新字符串即可。
用以上方法逐段取字符,直至除独立段之外的其他字符取完。
独立段字符个数小于8,不需要重排,直接拼接到新字符串的尾部即可。
实现该功能的VB程序功能如下:程序运行时从文本框Text1中输入一段字符串,在文本框Text2输入正整数m,单击“确定”按钮Command1,对字符串按上述方法重排后在文本框Text3中显示(每段以逗号分隔)。程序运行界面如下:
Private Sub Command1_lick( )
Dim s1 As String, s2 As String
Dim i As Integer, sum As Integer, ed As Integer, n As Integer
Dim m As Integer
s1 = Mid(Text1. Text, 1, Len(Text1. Text)- n)
m = Val(Text2. Text)
s2 = " "
' 字符重排顺序
sum = 0 : i = 1 : ed = 8
Do While Len(s1)< > 0
sum = sum + 1
If sum = m Then
s2 = s2 + Mid(s1, i, 1)
s1 = Mid(s1, 1, i-1)+ Mid(s1, i+1, Len(s1)-i)
ed = ed – 1
sum = 0
Else
i = i + 1
End If
If ed = 1 Then
s2 = s2 + Mid(s1, 1, 1)+ ", "
ed = 8
i = 1
ElseIf Then
i = 1
End If
Loop
' 处理独立段
If n < > 0 Then s2 = s2 + Mid(Text1. Text, Len(Text1. Text)- n + 1, n)+ ", "
Text3. Text = s2
End Sub