当前位置: > 如何用VB求一元二次方程的虚数解(一定是虚数解)....
题目
如何用VB求一元二次方程的虚数解(一定是虚数解).

提问时间:2020-10-28

答案
解一元二次方程的Vb程序:
在窗体上画一个命令按钮,输入下列代码,运行后可在窗体打印结果.
Private Sub Command1_Click()
dim a as double,b as double ,c as double,x as string
a=inputbox("请输入系数a:")
b=inputbox("请输入系数b:")
c=inputbox("请输入系数c:")
x=QuarEquation(a,b,c)
print x
end sub
printe function QuarEquation(byval a as double,byval b as double,byval c as double) as string
dim a as double,b as double ,c as double,P as double
dim xr as double ,xi as double ,x as string,xp as double
dim x1 as string,x2 as string,hh as string
hh=chr(13)+chr(10)
xr=-b/2
p=b^2-4*a*c
select case p
case is >0
xp=sqr(P)/2
x1=xr+xp
x2=xr-xp
x="x1=" & x1 & ";" & hh "x2=" & x2
QuarEquation=x
case is = 0
x="x1=x2=" &xr
QuarEquation=x
case is
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
版权所有 CopyRight © 2012-2019 超级试练试题库 All Rights Reserved.