数据输入后不显示任何内容

问题描述 投票:0回答:1

数据输入后不显示任何内容

program g
implicit none
    real::q,n,s,z,q2,y,free_board,r,b,e,A,h,t
    write(*,100)"pls insert discharge Q ="
    read(*,*)q
    write(*,100)"please insert Manning coefficient n ="
    read(*,*)n
    write(*,*)"please insert slope of the hydraulic channel ="
    read(*,*)s
    write(*,*)"please inset Z ="
    read(*,*)z
    write(*,*)"how much of b/y do you want?"
    write(*,*)"if it not important right 2.5"
    read(*,*)e
    if(e<2.or.e>5)then
        stop
    end if
    y=0

    do
        b=y*e
        A=b+2*y*((1+Z**2)**(0.5))
        R=((b+z*y)*y)/(b+(2*y*(1+z**2)**(0.5)))
        h=(1/n)*(r**(2/3))*A*(s)**0.5
       if( abs(h-q)<0.01) then
        exit
       end if




       y=0.001+y
    end do
    free_board=0.2*y
    h=free_board+y
    t=b+2*y*z


    write(*,100)"free board="
    write(*,*) free_board
    write(*,100)"y="
    write(*,*)y
    write(*,100)"b="
    write(*,*)b
    write(*,100)"T="
    write(*,100)t














    100 format(A)
end program g

这不起作用,输入数据后不显示任何内容

fortran fortran90
1个回答
0
投票

确定write(*,100)t行会给您错误的输出,因为“ t”是实数,而不是字符串。请更改为write(*,*)

[所有输入等于1.0并通过将e = 2.5输入,我将在屏幕上看到这些输出:

  • 免费板= 3.7200041E-02
  • y = 0.1860002
  • b = 0.4650005
  • T = 0.8370009

如果看不到输出,则可能是您选择了错误的“ e”值(小于2或大于5)。

热门问题
推荐问题
最新问题