02.05.2014 Views

Patrick Corde & Anne Fouilloux

Patrick Corde & Anne Fouilloux

Patrick Corde & Anne Fouilloux

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Corrigés 242<br />

Corrigé de l’exercice 10<br />

1 program mat_transf<br />

2 implicit none<br />

3 integer, parameter :: n = 10, m = 3<br />

4 real, dimension(n,m) :: mat<br />

5 integer :: choix_methode, ios, num_ligne<br />

6 real, external :: carre, identite, logarithme<br />

7 real, intrinsic :: sqrt<br />

8 namelist/methode/choix_methode<br />

9<br />

10 ! Ouverture du fichier contenant la matrice.<br />

11 open( unit=1, file="exo6.matrice", &<br />

12 form="unformatted", action="read", &<br />

13 status="old", position="rewind", &<br />

14 iostat=ios )<br />

15 if (ios /= 0) &<br />

16 stop ’Erreur à l’’ouverture du fichier "exo6.matrice"’<br />

17 ! Lecture de la matrice.<br />

18 read(1) mat<br />

19 close(1)<br />

20 ! Ouverture du fichier contenant<br />

21 ! la namelist "methode".<br />

22 open( unit=1, file="exo10.namelist", &<br />

23 form="formatted", action="read", &<br />

24 status="old", position="rewind", &<br />

25 iostat=ios )<br />

26 if (ios /= 0) &<br />

27 stop ’Erreur à l’’ouverture du fichier "exo10.namelist"’<br />

28 read( unit=1, nml=methode )<br />

29 close( unit=1 )<br />

INSTITUT DU DÉVELOPPEMENT<br />

ET DES RESSOURCES<br />

EN INFORMATIQUE SCIENTIFIQUE<br />

Cours langage Fortran – 27 janvier 2006<br />

<strong>Patrick</strong> <strong>Corde</strong> et <strong>Anne</strong> <strong>Fouilloux</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!