fortran小学生,请教各位这个fortran程序哪里不对,求解一元二次方程提示我Expected a right parenthesis in expression f=(-0.5*b/a,0.5*d/a)Expected a right parenthesis in expression g=(-0.5*b/a,0.5*d/a)programimplicit nonereal ::a,b

来源:学生作业帮助网 编辑:作业帮 时间:2024/09/08 17:56:51
fortran小学生,请教各位这个fortran程序哪里不对,求解一元二次方程提示我Expected a right parenthesis in expression f=(-0.5*b/a,0.5*d/a)Expected a right parenthesis in expression g=(-0.5*b/a,0.5*d/a)programimplicit nonereal ::a,b
xSMo@+CN{KƝשdmF27҆"P!jKJ8 6k$!Q{gw^vY06|CG;Ukx}/|~o%Jl >'|w;'NW"/iGig4^=b ̩naFhI| =F|q)غR\/S -ʫ =V;uNԥ\ 3D[H?$Bbl %r'/D6MWlT! 6ODcQ0T$7dlC5wU=?dbedr93' 5ЙingD2æ2H'cPcVI1P/7]:Plgj9dмJwa4xGz_N%xJz(O @bU~ov$,Q7Lkd@RRfo _U/gO͸ϝxHQNK(=8Yc$ x$\as س<M\m`o=L+cXi

fortran小学生,请教各位这个fortran程序哪里不对,求解一元二次方程提示我Expected a right parenthesis in expression f=(-0.5*b/a,0.5*d/a)Expected a right parenthesis in expression g=(-0.5*b/a,0.5*d/a)programimplicit nonereal ::a,b
fortran小学生,请教各位这个fortran程序哪里不对,求解一元二次方程
提示我Expected a right parenthesis in expression f=(-0.5*b/a,0.5*d/a)
Expected a right parenthesis in expression g=(-0.5*b/a,0.5*d/a)
program
implicit none
real ::a,b,c,d,e
complex f,g
print*,"please input a,b,c"
read*,a,b,c
d=abs(b*b-4*a*c)
e=sqrt(d)
f=(-0.5*b/a,0.5*e/a)
g=(-0.5*b/a,-0.5*e/a)
if (a/=0) then
print*,"one root is ",f
print*,"the other root is ",g
elseif ((a==0) .and.(b/=0)) then
print*," x=",-c/b
else
print*,"there are many roots"
endif
end program

fortran小学生,请教各位这个fortran程序哪里不对,求解一元二次方程提示我Expected a right parenthesis in expression f=(-0.5*b/a,0.5*d/a)Expected a right parenthesis in expression g=(-0.5*b/a,0.5*d/a)programimplicit nonereal ::a,b
program t !// Program 后面必须有名称,例如 t,不能是空的

implicit none

real :: a, b, c,d,e
complex f,g
print*, "please input a,b,c"
read*,a, b, c

d=abs(b*b-4*a*c)
e=sqrt(d)
f=cmplx(-0.5*b/a,0.5*e/a) !// 把两个数合成为复数,用 cmplx
g=cmplx(-0.5*b/a,-0.5*e/a) !// 同上
if (a/=0) then
print*, "one root is ", f
print*, "the other root is ", g
elseif ((a==0) .and. (b/=0)) then
print*, " x=", -c/b
else
print*, "there are many roots"
endif
end program