如何用VB求一元二次方程的虚数解(一定是虚数解).
答案:2 悬赏:80 手机版
解决时间 2021-02-17 20:55
- 提问者网友:那叫心脏的地方装的都是你
- 2021-02-17 14:23
如何用VB求一元二次方程的虚数解(一定是虚数解).
最佳答案
- 五星知识达人网友:西岸风
- 2021-02-17 15:21
解一元二次方程的Vb程序:在窗体上画一个命令按钮,输入下列代码,运行后可在窗体打印结果.Private Sub Command1_Click()dim a as double,b as double ,c as double,x as stringa=inputbox(请输入系数a:)b=inputbox(请输入系数b:)c=inputbox(请输入系数c:)x=QuarEquation(a,b,c)print xend subprinte function QuarEquation(byval a as double,byval b as double,byval c as double) as stringdim a as double,b as double ,c as double,P as double dim xr as double ,xi as double ,x as string,xp as doubledim x1 as string,x2 as string,hh as stringhh=chr(13)+chr(10)xr=-b/2p=b^2-4*a*cselect case pcase is >0xp=sqr(P)/2x1=xr+xpx2=xr-xpx=x1= & x1 & ; & hh x2= & x2QuarEquation=xcase is = 0x=x1=x2= &xrQuarEquation=xcase is
全部回答
- 1楼网友:不甚了了
- 2021-02-17 16:24
感谢回答
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯