gfortran - Fortran on Code Blocks_Linux Mint -
i start using code blocks programing in fortan. created console app, compiling gnu fortran compiler , when start compiling got mesage:
/media/aleksandar/hd_2/programiranje/code blocks/fortran/aleksandar/main.f95|15|/media/aleksandar/hd_2/programiranje/code blocks/fortran/aleksandar/main.f95 15 .1:|
||warning: nonconforming tab character |
/media/aleksandar/hd_2/programiranje/code blocks/fortran/aleksandar/main.f95|15|/media/aleksandar/hd_2/programiranje/code blocks/fortran/aleksandar/main.f95 15 .25:|
||error: unexpected end of format string in format string |
||=== build failed: 1 error(s), 7 warning(s) (0 minute(s), 0 second(s)) ===|
what problem code?
this code:
program kto !program za sortiranje niza (rastuce opadajuce vrijednosti) implicit none integer::i,n,odabir real,dimension(24)::ppot logical::max !otvaranje datoteke sa podacima o potrosnji !kad se ucitava kolona na ovaj nacin uvijek ide n+1 broj ucitavanja !strogo paziti na ovo open(8,file='ulaz',status='old') read(8,'(i3,/,25(f5.1,/)')n,(ppot(i),i=1,n) close(8) write(*,'(2x,"kakvo sortiranje zelite?",//,& 2x,"1 - opadajuce vrijednosti?",/,& 2x,"2 - rastuce vrijednost?")') read(*,'(i2)') odabir if (odabir.eq.1) max=.true. else max=.false. end if call sort(n,ppot,max) ! ispis podataka u datoteku open(10,file='izlaz',status='unknown') write(10,'(1x,14hsortirani niz:,24(/,f5.1))') (ppot(i),i=1,n) close(10) stop end program kto !potprogram za sortiranje subroutine sort(n,ppot,max) implicit none integer::i,j integer,intent(in)::n real,dimension(n),intent(inout)::ppot logical,intent(in)::max real::pom if (max.eqv..true.) i=1,n-1 j=i+1,n if (ppot(i).lt.ppot(j)) pom=ppot(i) ppot(i)=ppot(j) ppot(j)=pom end if end end else i=1,n-1 j=i+1,n if (ppot(i).gt.ppot(j)) pom=ppot(i) ppot(i)=ppot(j) ppot(j)=pom end if end end end if return end subroutine sort
i have compiled code gfortran4.7.2. @albert suggested, following line turned out error:
read(8,'(i3,/,25(f5.1,/)')n,(ppot(i),i=1,n) if fixed to
read(8,'(i3,/,25(f5.1,/))')n,(ppot(i),i=1,n) ^--- added or
read(8,'(i3,/,25(f5.1),/)')n,(ppot(i),i=1,n) ^--- added the code started run, aborted because have no file "ulaz".
Comments
Post a Comment