早教吧作业答案频道 -->其他-->
用VB解一元二次方程ax^2+bx+c=0的流程图
题目详情
用VB解一元二次方程ax^2+bx+c=0的流程图
▼优质解答
答案和解析
在窗体上分别放三个文本框用于输入a,b,c的值,再放一个按钮用于求解
private sub command1_click()
dim x as double,x1 as double,x2 as double,a1 as double,a2 as double
a =val(text1.text)
b =val(text2.text)
c =val(text3.text)
cls
currentx=600
currenty=1100
if a =0 then
if b =0 then
msgbox "系数为0,请重新输入!"
text1.setfocus
text1.selstart=0
text1.sellength=len(text1.text)
else
x=-c/b
print "x=";format(x,"0.000")
end if
exit sub
end if
dim n as double
n=b^2-4*a*c
select case n
case 0
print "x1=x2=";format(-b/(2*a),"0.000")
case is >0
x1=(-b+sqr(n)/(2*a)
x2=(-b-sqr(n)/(2*a)
print "x1=";format(x1,"0.000")
currentx=600
currenty=1300
print "x2=";format(x2,"0.000")
case is
private sub command1_click()
dim x as double,x1 as double,x2 as double,a1 as double,a2 as double
a =val(text1.text)
b =val(text2.text)
c =val(text3.text)
cls
currentx=600
currenty=1100
if a =0 then
if b =0 then
msgbox "系数为0,请重新输入!"
text1.setfocus
text1.selstart=0
text1.sellength=len(text1.text)
else
x=-c/b
print "x=";format(x,"0.000")
end if
exit sub
end if
dim n as double
n=b^2-4*a*c
select case n
case 0
print "x1=x2=";format(-b/(2*a),"0.000")
case is >0
x1=(-b+sqr(n)/(2*a)
x2=(-b-sqr(n)/(2*a)
print "x1=";format(x1,"0.000")
currentx=600
currenty=1300
print "x2=";format(x2,"0.000")
case is
看了 用VB解一元二次方程ax^2...的网友还看了以下:
(x+1)(x-4)-(x-5)(x-1)=0尽量用公式算、若2的a次方=3,2的b次方=5,2的 2020-04-27 …
已知关于x的四次三项式(a-b)x的四次方+(b-1)x的三次方-(a-2)x的二次方+ax-4 2020-05-13 …
若关于一个x的多项式(a-4)x的4次方-x的b次方+x-b为二次三项式,那么a= ,b=,如果x 2020-05-16 …
利用公式am+bm+cm=m(a+b+c),当x的2次方+x-1=2a+b-c=5,求a(x的2次 2020-06-03 …
·logx(y的七次方根)=z,用指数式表示x,y,z之间的关系是A.y七次方=x的z次方B.y= 2020-07-06 …
把0,1,2,3,4,5,6,7,8,9每个数字只能用一次[]x[]=[][],[]+[]=[], 2020-07-15 …
如图,在直角△ABC中,∠B=90°,点M,N分别在边BA,BC上,且BM=BN如果AB=a,BC 2020-07-15 …
-x的二次方+ax+b假如用x=-2.-x的二次方+ax+b假如用x=-2,求的的值是1;用x=2 2020-07-17 …
A=[021/2-13/-33-4]B=[123/2-31]XA=B求X.用初等列变换做……变了一 2020-08-02 …
asinx+cosx=b,求x用ab的反三角函数表示, 2020-08-03 …