用VB编写一个三角函数(tan尀sin尀cos这些计算,以及数值与角度的运算)例如tan45=1,π=3.14等.急求啊

2024-11-07 16:40:31
推荐回答(1个)
回答(1):

给你个例子参考:


代码如下:


Option Explicit


Private Sub Command1_Click()

Dim y As Double

Dim Scr As Object

Dim dss As String

dss = UCase(Text1.Text)        '读取代数式

Set Scr = CreateObject("MSScriptControl.ScriptControl")

Scr.Language = "Vbscript"


y = Scr.Eval(dss)

Text2.Text = y

End Sub


Private Sub Command2_Click()

  End

End Sub