发布网友
共2个回答
热心网友
窗体上的控件建立如图所示:
Private Sub Command1_Click()
If Text1.Text <> "" And Text2.Text <> "" Then
Text3.Text = Format(CStr(Val(Text1.Text) * Tan(Val(Text2.Text) * 3.141592653579 / 180)), "0.000") '保留三位小数
Else
MsgBox "数据输入不完整"
End If
End Sub
Private Sub Command2_Click()
End
End Sub
热心网友
Private Sub Command1_Click()
Dim n!, s!, mp!
s = CSng(InputBox("请输入一个整数"))
mp = 1
For n = 1 To s
mp = mp * n
If mp > s Then
Print "MAXn= "; n - 1
Exit For
End If
Next
End Sub
Private Sub Command2_Click()
Dim n!, s!, mp!
s = CSng(InputBox("请输入一个整数"))
mp = 1
n = 1
Do While mp < s
mp = mp * n
n = n + 1
Loop
Print "MAXn= "; n - 2
End Sub