首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

急用

2012-02-19 
急用,求助OptionExplicitPrivateSubForm_Load()Dima#,b#,c#,d#,y1#,y2#,x#,y#a2b3c4d5y1a*x^by2c*x^

急用,求助
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

热点排行
Bad Request.