VB问题!!!希望各位大大帮忙解决下!!!感谢了!!!
Option ExplicitPrivate Sub Command1_Click()
Dim a As Double, b As Double
Dim y As Double
Const Pi As Single = 3.14
Dim i As Double, j As Double
a = Val(InputBox("请输入任意整数a:"))
b = Val(InputBox("请输入任意整数b:"))
i = Sin((a / 360) * 2 * Pi): j = Cos((b / 360) * 2 * Pi)
If a > 0 And b > 0 Then
y = Log(a) + Log(b)
ElseIf a > 0 And b <= 0 Then
y = Sin((a / 360) * 2 * Pi) + Sin((b / 360) * 2 * Pi)
ElseIf a <= 0 Then
y = Sin((a / 360) * 2 * Pi) + Cos((b / 360) * 2 * Pi)
End If
Print y
End Sub
Private Sub Form_Load()
Command1.Caption = "确定"
End Sub
上面是我的代码,为什么当a<0时,SIN+COS的输出会有问题,按道理应该是0左右,但是VB输出的是6.4左右。希望各位给出解答!!!! --------------------编程问答-------------------- VB使用的是弧度,不是角度。
360角度 = 2 * pi 弧度。
补充:VB , 非技术类