FORTRAN 41
Rw.f Guest on 22nd August 2020 04:36:19 AM
  1.       program rw
  2.       implicit none
  3.       integer i,n,ios,ntot
  4.       parameter (i=100)
  5.       real s(i),c02(i),c04(i),c06(i),c08(i),c10(i),c12(i),c14(i)
  6.       real c16(i),c18(i),c20(i)
  7.       character*30 inpfile,outfile
  8. C
  9.       write(*,*) 'Entrer the name of the file to read :'
  10.       read(*,*) inpfile
  11.       write(*,*) 'Enter the name of the file to write :'
  12.       read(*,*) outfile
  13. C
  14.       n=1
  15.       ios=0
  16.       OPEN(UNIT=3,FILE=inpfile,status='old')
  17.       do while (ios.eq.0)
  18.          read(3,*,end=53,iostat=ios) s(n),c02(n),c04(n),c06(n),c08(n),
  19.      >       c10(n),c12(n),c14(n),c16(n),c18(n),c20(n)
  20.            n = n+1
  21.         end do
  22.  53     close(unit=3)
  23.         ios=0
  24.         ntot = n-1
  25.         write(*,*) 'tot=',ntot
  26.         open(unit=69,file=outfile,status='new')
  27.         write(69,*) '#seeing c02  c04    c06    c08    c10    c12    c14
  28.     >   c16     c18   c20'
  29.         do n=1,ntot
  30.            if (c02(n).ge.10.) c02(n)=9.9999
  31.            write(69,12) s(n),c02(n),c04(n),c06(n),c08(n),
  32.      >       c10(n),c12(n),c14(n),c16(n),c18(n),c20(n)
  33.         enddo
  34.         close(unit=69)
  35.  12     format(1x,f3.1,10(1x,f6.4))
  36.  
  37.         end

Paste is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.