帮我写画函数图像的VB代码
帮我写画函数图像的VB代码要能给我二次函数、指数函数、幂函数、对数函数.见答案我一定加分,劳驾...
帮我写画函数图像的VB代码
要能给我二次函数、指数函数、幂函数、对数函数.见答案我一定加分,劳驾 展开
要能给我二次函数、指数函数、幂函数、对数函数.见答案我一定加分,劳驾 展开
1个回答
展开全部
给你写两个,其他你可以依照这个方法自己写。
Private Sub Command1_Click() '二次函数
Dim a As Integer, b As Integer, c As Integer, x As Single, y As Single, i As Single
cls
a = InputBox("请输入a的值:")
b = InputBox("请输入b的值:")
c = InputBox("请输入c的值:")
x = -b / (2 * a)
y = (4 * a * c - b ^ 2) / (4 * a)
Form1.Scale (x - 10, y + 10)-(x + 10, y - 10)
Form1.Line (x - 10, 0)-(x + 10, 0), RGB(255, 0, 0)
Form1.Line (0, y - 10)-(0, y + 10), RGB(255, 0, 0)
For i = x - 10 To x + 10 Step 0.01
Form1.PSet (i, a * i ^ 2 + b * i + c)
Next i
End Sub
Private Sub Command2_Click() '指数函数
Dim a As Integer, x As Single, y As Single, i As Single
cls
a = InputBox("请输入a的值:")
Form1.Scale (-10, 18)-(10, -2)
Form1.Line (-10, 0)-(10, 0), RGB(255, 0, 0)
Form1.Line (0, 18)-(0, -2), RGB(255, 0, 0)
For i = -10 To 10 Step 0.01
Form1.PSet (i, a ^ i)
Next i
End Sub
Private Sub Command1_Click() '二次函数
Dim a As Integer, b As Integer, c As Integer, x As Single, y As Single, i As Single
cls
a = InputBox("请输入a的值:")
b = InputBox("请输入b的值:")
c = InputBox("请输入c的值:")
x = -b / (2 * a)
y = (4 * a * c - b ^ 2) / (4 * a)
Form1.Scale (x - 10, y + 10)-(x + 10, y - 10)
Form1.Line (x - 10, 0)-(x + 10, 0), RGB(255, 0, 0)
Form1.Line (0, y - 10)-(0, y + 10), RGB(255, 0, 0)
For i = x - 10 To x + 10 Step 0.01
Form1.PSet (i, a * i ^ 2 + b * i + c)
Next i
End Sub
Private Sub Command2_Click() '指数函数
Dim a As Integer, x As Single, y As Single, i As Single
cls
a = InputBox("请输入a的值:")
Form1.Scale (-10, 18)-(10, -2)
Form1.Line (-10, 0)-(10, 0), RGB(255, 0, 0)
Form1.Line (0, 18)-(0, -2), RGB(255, 0, 0)
For i = -10 To 10 Step 0.01
Form1.PSet (i, a ^ i)
Next i
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |