回 帖 发 新 帖 刷新版面

主题:求大家帮忙啦!!!快快,谢谢

program test2
    implicit none 
    real::k1,k2,k3,w
    real::a1,a2
    real::n,m,c
    real::i,j
    c=1000
    n=800
    m=800
    do 10 i=0,n
    a2=i/10
    do 20 j=0,m
    a1=j/10
    k1=sqrt(2.0)*a1*(1-a1)/(2a1-1)
    k2=2**0.5*(1-a1)/2
    k3=3*sqrt(2.0)*a1**2/(4-6a1)
    if(a2.ge.k1)then
    if(a2.ge.k2)then
    if(a2.ge.k3)then
    w=2*2**0.5*a1+a2
    c=min(c,w)
    endif
    endif
    endif
20    continue    
10    continue
    print*,w
    endprogram test2
    这个程序不能运行,不知道哪有问题,希望大家给看看,谢谢!

回复列表 (共3个回复)

沙发

2a1改为2*a1
6a1改为6*a1
不知道我的理解可对。

板凳

program main
  implicit none

  call test2

  stop
end program main



subroutine test2
    implicit none 
    real::k1,k2,k3,w
    real::a1,a2
    real::c
    integer::m, n, i, j
    c=1000
    n=800
    m=800
    do 10 i=0,n
    a2=i/10.0
    do 20 j=0,m
    a1=j/10.0
    k1=sqrt(2.0)*a1*(1.0-a1)/(2.0*a1-1.0)
    k2=sqrt(2.0) * (1.0-a1) / 2.0
    k3=3.0*sqrt(2.0)* a1**2 /(4.0 - 6.0*a1)
    if(a2.ge.k1)then
    if(a2.ge.k2)then
    if(a2.ge.k3)then
      w=2*2**0.5*a1+a2
      c=min(c,w)
    endif
    endif
    endif
20    continue    
10    continue
    print*,w
end subroutine test2

3 楼

可以运行了

program test2
    implicit none
     
    real::k1,k2,k3,w
    real::a1,a2,c
    integer::n,m
    integer::i,j

    c=1000
    n=800
    m=800

10    do  i=0,n
       a2=i/10
20     do  j=0,m
          a1=j/10
          k1=sqrt(2.0)*a1*(1-a1)/(2.0*a1-1)
          k2=2.0**0.5*(1-a1)/2
          k3=3.0*sqrt(2.0)*a1**2/(4.0-6.0*a1)
          if(a2.ge.k1)then
          elseif(a2.ge.k2)then
          elseif(a2.ge.k3)then
             w=2.0*2.0**0.5*a1+a2
             c=min(c,w)
          endif
        enddo
    enddo
    continue    
    continue  
    print*,w
 end program test2

我来回复

您尚未登录,请登录后再回复。点此登录或注册