纪念品分组问题。某教师节晚会的纪念品分组规则如下:按纪念品价值进行分组,每组总价值不超过限定值w且最多包含两件,要求分组数最少。编写VB程序解决该问题,程序运行时,在文本框Text1中依次输入每件纪念品的价格(不超过w),以逗号分隔,在文本框Text2中输人限定值w,单击“分组”按钮,在标签 Label2上输出最少的分组数。程序运行界面如图所示。

(1)要使程序启动后,窗体的标题栏显示“纪念品分组”文字,可在 Form Load事件过程中添加语句
(单选,填字母:
A.Form1="纪念品分组"/ | B.Form1.Name="纪念品分组"/ | C.Form1. Caption="纪念品分组"/ | D.Fom1.Text="纪念品分组")。 |
(2)实现上述功能的VB程序如下,请在划线处填入合适的代码;并且加框处代码有错,请改正。
Private Sub Command1 Click()
Dim a(l To 1000), n As Integer, w As Integer,cnt As Integer
Dim i As Integer, j As Integer, t As Integer
Dim s As String, ch As String
Dim p As Integer, q As Integer
S= Textl. Text: w =Val(text2. Text): n=0
For i=1 To Len(s)
ch=Mid(s, i, 1)
If ch="."Then
n=n+1:a(n)=t: t=0
Else
t=_________①___________
End If
Next i
For i=n To 2 Step-1
For j=1 To
'②
If a(j)< a(j+1)Then
t=a(j):a(j)=a(j+1):a(j+1)=t
End If
Next j
Next i
cnt= 0
p=1: q=n
Do While p<q
cnt=cnt+1
If ________③_________ Then
p=p+1:q=q-1
Else
p=p+1
End If
Loop
If p=q Then cnt=cnt+1
Label2 Caption- Str(cnt)
End sub
(3)若在文本框Text1中输入“50,30,100,70,80,40,50,20”,文本框Text2中输人“110”,单击“分组”按钮,标签Labe2中显示的内容是____________。