3.
【加试题】有30个人,其中有男人、女人和小孩,他们在一家商场花去500元。已知,每个男人花20元,每个女人花30元,每个小孩子花10元。问男人、女人、小孩各为多少人?解决上述问题的VB程序如下,单击按钮Command1,列表框List1中输出结果。
Privvate Sub Command1Click( )
Dim man As Integer,woman As Integer,child As Intger,s As Integer
For woman = 1 To 15
Child = 30 – man – woman
S = 20 * man + 30 * woman + 10 * child
If Then
List1.AddItem Str(man) + Str(woman) + Str(child)
End If
Next woman
Next man
End Sub