vb,画正弦曲线
这个是我简单写的函数PrivateSubCommand1_Click()Picture1.Scale(-10,10)-(10,-10)Picture1.Line(-10,...
这个是我简单写的函数
Private Sub Command1_Click()
Picture1.Scale (-10, 10)-(10, -10)
Picture1.Line (-10, 0)-(10, 0)
Picture1.Line (0, -10)-(0, 10)
Dim i As Integer
For i = -8 To 8 Step 0.0001
Picture1.PSet (i, 5 * Sin(i))
Next i
End Sub
问题是sin()中的变量应该是双精度的,系统应该报错啊,可是运行时vb就死那了,怎么回事, 展开
Private Sub Command1_Click()
Picture1.Scale (-10, 10)-(10, -10)
Picture1.Line (-10, 0)-(10, 0)
Picture1.Line (0, -10)-(0, 10)
Dim i As Integer
For i = -8 To 8 Step 0.0001
Picture1.PSet (i, 5 * Sin(i))
Next i
End Sub
问题是sin()中的变量应该是双精度的,系统应该报错啊,可是运行时vb就死那了,怎么回事, 展开
4个回答
展开全部
Dim i As Integer
i+0.01的结果还是i,i值并没有增加,所以成了死循环。
Private Sub Command1_Click()
Picture1.Scale (-10, 10)-(10, -10)
Picture1.Line (-10, 0)-(10, 0)
Picture1.Line (0, -10)-(0, 10)
Dim i
For i = -8 To 8 Step 0.01
Picture1.PSet (i, 5 * Sin(i))
Next i
End Sub
i+0.01的结果还是i,i值并没有增加,所以成了死循环。
Private Sub Command1_Click()
Picture1.Scale (-10, 10)-(10, -10)
Picture1.Line (-10, 0)-(10, 0)
Picture1.Line (0, -10)-(0, 10)
Dim i
For i = -8 To 8 Step 0.01
Picture1.PSet (i, 5 * Sin(i))
Next i
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
For i = -8000 To 8000 Step 1
Picture1.PSet (i, 5 * Sin(i/10000))
Next i
Picture1.PSet (i, 5 * Sin(i/10000))
Next i
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询