VB中求正弦,余弦值问题 '回答者:星空无月(xkwy)Private Sub Command1_Click()txtResult.Text=Sin(Val(Val(txtInput.Text)*3.14159/180))End Sub★附MSDN关于Val()函数的解释:
怎样用vb求余弦?怎样编写,谢谢 Option ExplicitConst Pi As Double=3.1415626Sub 测试()Dim X As Double,JD As Double,HD As DoubleJD=30 '角度,度HD=JD*Pi/180 '弧度'取指定角度的余弦X=Cos(HD)'根据余弦求度数X=ArcCos(X,4)MsgBox\"根据余弦求度数:ArcCos(X)=>;>;>;\"&XEnd SubPublic Function ArcCos(ByVal X As Double,ByVal Dic As Integer)As Double'根据余弦求度数'参数:余弦(单位弧度),小数位数'返回:角度,度数(十进制)ArcCos=Atn(-X/Sqr(-X*X+1))+2*Atn(1)ArcCos=Round(ArcCos/Pi*180,Dic)End Function不知对你有否帮助?
vb中用pi和函数来求角度的余弦值 cos(a*pi/180)a用角度值代入