vb中获取function返回值
3个回答
推荐于2018-02-12
展开全部
Private Function f(x As Double) As Double '函数:f(x)=x^2+1
f = x ^ 2 + 1 '返回f
End Function
Private Sub Command1_Click() '调用
Dim y As Double, x As Double
x = 2
y = f(x) '调用f(x),返回值赋给变量y
Print y
End Sub
展开全部
Private Function f(x As Double) As Double '函数:f(x)=x^2+1
f = x ^ 2 + 1 '返回f
End Function
Private Sub Command1_Click() '调用
Dim y As Double, x As Double
x = 2
y = f(x) '调用f(x),返回值赋给变量y
Print y
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Function f(x As Double) As Double '函数:f(x)=x^2+1
f = x ^ 2 + 1 '返回f
End Function
Private Sub Command1_Click() '调用
Dim y As Double, x As Double
x = 2
y = f(x) '调用f(x),返回值赋给变量y
Print y
End Sub
f = x ^ 2 + 1 '返回f
End Function
Private Sub Command1_Click() '调用
Dim y As Double, x As Double
x = 2
y = f(x) '调用f(x),返回值赋给变量y
Print y
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询