得2枚金币,再接下来的3天(第4、5、6 天)每天获得3枚金币……,依次类推,即当连续n天每天获得n枚金币后,会在之后的连续n+1天里,每天获得n+1枚金币。
小王用VB编写了工资计算程序,当输入连续工作的最后一天的日期后,单击“计算”按钮 Command1,程序自动计算工资总额,其运行界面如图所示。
实现上述功能的VB 程序如下,请回答下列问题:
Dim i As Integer, j As Integer, k As Integer Dim m As Integer, d As Integer, n As Integer Dim md As String, sum As Integer
md = "312831303130313130313031"
n = 0
m = Val(Text1.Text) d = Val(Text2.Text)
For i = 1 To m - 1 n = ①
Next i
n = n + d
i = 0: j = 0
sum = 0: k = 1 Do While i < n sum =
j = j + 1
If ② Then j = 0
k = k + 1
End If
i = i + 1 Loop
Text3.Text = Str(sum) End Sub