Option Explicit
Private Sub Form_Click()
Dim Angle, Result As Single
Angle = InputBox("請輸入要計算的角度:", "正弦函數計算機", 30)
Result = Sin(AngleToRad(Angle))
Print "計算結果:sin(" & Angle & ") = " & Result
End Sub
Private Sub Form_Load()
welcome
End Sub
Private Sub Form_OKClick()
App.End
End Sub
Private Sub welcome()
MsgBox "歡迎使用sin函數計算系統", vbOKOnly, "Sin"
End Sub
Private Function AngleToRad(ang As Single)
Dim PI As Single
PI = Atn(1) * 4
AngleToRad = (ang * PI) / 180
End Function
沒有留言:
張貼留言