急用,求助
Option Explicit
Private Sub Form_Load()
Dim a#, b#, c#, d#, y1#, y2#, x#, y#
a = 2
b = 3
c = 4
d = 5
y1 = a * x ^ b
y2 = c * x ^ d
y = y1 + y2
Text1.Text = y
End Sub
我想运行后Text1.Text输出为2*x^3+4*x^5
但上面的代码运行后Text1.Text输出为0
该怎么修改
[解决办法]
换成字符类型吧,定义成非类型的处理得不到效果。楼主定义的X初值为0,运算结果自然为0了。
eg:
dim a as integer,x as string,b as integer,c as integer,d as integer
text1.text=a & "*x "& "^ "& b & "+ " & c & "*x " & "^ " & d