02.05.2014 Views

Patrick Corde & Anne Fouilloux

Patrick Corde & Anne Fouilloux

Patrick Corde & Anne Fouilloux

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Corrigés 241<br />

30 select case (critere)<br />

31 case(1) ! Recherche par date de naissance.<br />

32 print*, "Entrer une date de naissance d’un musicien"<br />

33 rewind( unit=critere )<br />

34 case(2) ! Recherche par date de décès.<br />

35 print*, "Entrer une date de décès d’un musicien"<br />

36 rewind( unit=critere )<br />

37 case default ! Quitter<br />

38 exit<br />

39 end select<br />

40 read *, date_saisie<br />

41 ! Recherche de la date saisie dans le fichier d’index.<br />

42 read( unit=critere, fmt=*, &<br />

43 iostat=ios_index ) date_lue, numrec<br />

44 do while( ios_index == 0 )<br />

45 if ( date_lue == date_saisie ) then<br />

46 ! On lit l’enregistrement correspondant.<br />

47 trouve = .true.<br />

48 read( unit=3, rec=numrec ) mus<br />

49 print *,trim(mus)<br />

50 end if<br />

51 read( unit=critere, fmt=*, &<br />

52 iostat=ios_index ) date_lue, numrec<br />

53 end do<br />

54 if ( .not. trouve ) &<br />

55 print *,"Aucun musicien ne répond au critère indiqué."<br />

56 print ’(/)’<br />

57 end do<br />

58 close( unit=1 )<br />

59 close( unit=2 )<br />

60 close( unit=3 )<br />

61 end program sequentiel_indexe<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!