program atlagolo c 365 x 24 adatot tud feldolgozni c V µ L T O Z ą K integer i, n, m c ciklusv ltoz¢k integer db c h ny db adat lesz az £j file-ban? character*7 oldfile, nevo c a felhaszn l¢ megadja a file nev‚t character*7 newfile, nevn c az elksz”tend‹ file neve integer kr, v c technikai konstansok real ertek(9999), atlag(999), sum, adat logical vegee c F I L E - O K M E G J E L ™ L  S E write(*,*)'mit dolgozzak fel? (????.dat)' call ofilenyit(oldfile,nevo,7) write(*,*)'hogy nevezzem az £j file-t? (???????.dat)' call nfilenyit(newfile,nevn,8) c A D A T V E K T O R : ertek(sorszam)=adat c /------------------- v=0 call beolvas(7,vegee,adat) 46 if(vegee) goto 49 v=v+1 ertek(v)=adat goto 47 47 continue call beolvas(7,vegee,adat) goto 46 c \------------------- 49 continue write(*,700)v 700 format(i5,' adatot tal ltam') c S Z µ M O L µ S write(*,69) 69 format('napi menetet fogok kiszamolni',//) db=0 c ---> napi menet do 51 i=1,24 sum=0 do 50 n=1,365 kr=(n-1)*24+i sum=sum+ertek(kr) 50 continue atlag(i)=sum/365 write(*,701)i,atlag(i) 701 format(i3,'. nap atlaga: ',f10.4,//) db=db+1 51 continue write(*,*)'kiszamoltam' c A D A T O K F I L E - B A Ö R µ S A do 54 m=1,db write(8,71)m,atlag(m) 71 format(i3,5x,f19.5) 54 continue close(7) close(8) end subroutine beolvas(cs,l,adat) integer cs logical l real adat read(cs,7001,end=21) adat 7001 format(20x,f9.0) l=.false. goto 22 21 continue l=.true. 22 continue return end subroutine nfilenyit(nev,ven,cs) c nev: a megnyitand¢ flie neve c cs: a csatorna c ven: a megnyitand¢ file neve behelyettes”t‚skor character*7 nev,ven integer cs write(*,*)"file neve:" read(*,70)ven 70 format(a7) write(nev,70)ven open(cs, file=nev//'.dat',access='sequential', x status='new', err=9991) write(*,71)ven 71 format('a ', a7, '.dat file l‚trehozva') goto 10 9991 write(*,*)"error" 10 continue end subroutine ofilenyit(nev,ven,cs) c nev: a megnyitand¢ flie neve c cs: a csatorna c ven: a megnyitand¢ file neve behelyettes”t‚skor character*4 nev,ven integer cs write(*,*)"file neve:" read(*,70)ven 70 format(a4) write(nev,70)ven open(cs, file=nev//'.dat',access='sequential', x status='old', err=9991) write(*,71)ven 71 format('a ', a4, '.dat file megnyitva') goto 10 9991 write(*,*)"error" 10 continue end