VB程序设计题:设计窗体程序,输入x,y的值,计算下面数学式子的值,
VB程序设计题:设计窗体程序,输入x,y的值,计算下面数学式子的值,并在输出信息框中显示计算结果值。(用InputBox函数)(有大神帮忙编程一下吗,谢谢啦!)...
VB程序设计题:设计窗体程序,输入x,y的值,计算下面数学式子的值,并在输出信息框中显示计算结果值。(用InputBox函数)(有大神帮忙编程一下吗,谢谢啦!)
展开
展开全部
vb6
Option Explicit
Const e = 2.718281828459
Const pi = 3.14159265358979
Const d2r = pi / 180#
Private Sub Form_Load()
Dim x As Double
Dim y As Double
Dim c1 As Double
Dim c2 As Double
x = InputBox("输入x(deg):")
y = InputBox("输入y(deg):")
If x = 0# Or y <= 0# Then
MsgBox ("输入数据超出公式计算范围!")
Exit Sub
End If
c1 = 2 * Sin(90# * d2r) + 2# * x * e ^ y
c1 = c1 / Sqr(Abs(x * y))
c2 = x * x * x + e ^ -6 * Log(y)
c2 = c2 * Sin(x * d2r) * Cos(y * d2r) / (x * x + y * y)
c1 = c1 + c2
If c1 < 0# Then
MsgBox ("输入数据超出公式计算范围!")
Exit Sub
End If
c1 = Sqr(c1)
MsgBox ("计算结果为:" & c1)
End Sub
展开全部
Dim e As Double
Private Sub Command1_Click()
Dim x As Double
Dim y As Double
e = 2.718281828459
Dim r1 As Double
Dim r2 As Double
r1 = (x ^ 3 + (e ^ (-6)) * Log(y)) * ((Sin(x) * Sin(y)) / (x ^ 2 + y ^ 2))
r2 = (2 + 2 * x * (e ^ y)) / (Sqr(Abs(x * y)))
Dim r As Double
r = Sqr(r1 + r2)
End Sub
更多追问追答
追问
怎么没出现inputbox
追答
Dim e As Double
Private Sub Command1_Click()
Dim x As Double
Dim y As Double
x=inputbox("请输入x")
y=inputbox("请输入y")
e = 2.718281828459
Dim r1 As Double
Dim r2 As Double
r1 = (x ^ 3 + (e ^ (-6)) * Log(y)) * ((Sin(x) * Sin(y)) / (x ^ 2 + y ^ 2))
r2 = (2 + 2 * x * (e ^ y)) / (Sqr(Abs(x * y)))
Dim r As Double
r = Sqr(r1 + r2)
print r;
End Sub
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询