program www_fcode_cn implicit none
integer , parameter :: NMAX = 2
character(len=9) :: cName(NMAX) , Z
real :: rMax(NMAX) , r
integer :: j
open(10,file='003.txt')
rMax = -huge(rMax)
Do
read(10,*,ioStat=j) z , z , r
if(j/=0) exit
if( any(rMax<r) ) then
j = maxloc( rMax , 1 , rMax<r )
rMax(j:) = [ r , rMax(j:NMAX-1) ]
cName(j:)= [ z , cName(j:NMAX-1) ]
end if
End Do
write(*,'(g0,1x,a)') ((rMax(j),cName(j)),j=1,NMAX)
end program www_fcode_cn
欢迎光临 Fortran Coder (http://bbs.fcode.cn/) | Powered by Discuz! X3.2 |