VB作业 很简单的 求帮忙

2024-11-26 04:30:39
推荐回答(3个)
回答1:

Private Sub Command1_Click()
Sum = 0
For n = 1 To Text1.Text
a = 1
For m = 1 To n
a = a * m
Next m
Sum = Sum + 1 / a
Next n
Print Sum
End Sub

回答2:

Private Sub Form_Click()
Dim n As Integer
Dim sum, func
sum = 0
func = 1
way1:
n = Val(InputBox("请输入n的值" & vbCrLf & "注意:n<=20"))
If n > 20 Then GoTo way1 '判断输入是否大于20,是,重新输入
For i = 1 To n
func = func * i
sum = sum + 1 / func
Next i
Print sum
End Sub

回答3:

Sub Text2_Click()
Text1.SelStart = 4
Text1.SelLength = 6
Text2.Text = Text1.SelText
End Sub
现在框1中写一段字符.单击框2就可以了.我已经上机验证了.完全正确
另外,虚机团上产品团购,超级便宜