Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
fortransqrt()错误_Fortran - Fatal编程技术网

fortransqrt()错误

fortransqrt()错误,fortran,Fortran,我是Fortran的新手,我一直在使用下面的程序来使用二次方程求根 它显示以下错误: d=sqrt(bsq\xE2\x80\x93 ac4) 1. 错误:参数列表中(1)处的语法错误 程序 隐式无 real::a,b,c,root1,root2 real::bsq、ac4、d 打印*,“请输入系数a、b和c作为实数” 读*,a,b,c bsq=b*b ac4=4*a*c 如果(bsq

我是Fortran的新手,我一直在使用下面的程序来使用二次方程求根

它显示以下错误:

d=sqrt(bsq\xE2\x80\x93 ac4) 1. 错误:参数列表中(1)处的语法错误

程序
隐式无
real::a,b,c,root1,root2
real::bsq、ac4、d
打印*,“请输入系数a、b和c作为实数”
读*,a,b,c
bsq=b*b
ac4=4*a*c
如果(bsq
bsq
ac4
之间需要一个减号,而不是破折号。仔细看

减号:-

破折号:–

谢谢,问题解决了
program quadratic
implicit none 
real :: a, b, c, root1, root2
real :: bsq, ac4, d 
print *, 'Please enter the coefficients a, b, and c as real numbers'
read *, a, b, c
bsq = b*b
ac4 = 4*a*c 
if ( bsq < ac4) then
d = sqrt(bsq – ac4)
root1 = (-b+d)/(2*a)
root2 = (-b+d)/(2*a)
print *, 'The real roots are ', root1, root2
else if ( root1==root2) then
root1 = root2
print *, 'There is one real root which is ', root1
else
print *, 'There are no real roots'
end if
end program quadratic