Bonjour,
j'ai un exercice à faire, et ca fait plusieurs jours que je m'y colle sans vrais résultats ...
Alors voila mon énoncé

(A file homework_6.dat contains book records: Name (up to 25 characters), publish year (4 digit integer), price (6 digit real), ISBN (13 digit integer). Write a program to read the file (homework_6.dat) and print out (on screen or into another file) the details in the following format:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
 
                                  Publish   
           Name                          Year      ($)        ISBN
       -------------------------      ----   ------     -------------
       Principles of Combustion       2005    107.61     9780471046899
       An Introduction to Comb        2011    193.99     9780073380193 
       Guide to Fortran               2009     71.95     9781848825420
       Modern Fortran Explain         2011    100.00     9780199601417
       Introduction to Program        2012    200.00     9780857292322)



Donc, j'ai un fichier .dat qui ce qu'il y a juste au dessus ( name, publish year ..) exactement sous cette forme.


Voila le programme que j'ai écrit
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
program dat
    implicit none
    character (len=25) :: Name
    integer :: i, publish_year, ISBN
    real :: price 
    open(unit=7, file="homework_6.dat", status="old", action="readwrite")
    open(unit=8, file="output_hw6.dat")
    !Comment: these below 3 lines are for skipping 3 heading your input                 
    read(7,*)
    read(7,*)
    read(7,*)
    do i=1, 10
    read (7,*) Name, publish_year, price, ISBN
    write (8,1) Name, publish_year, price, ISBN
    1 format(a25,2x,i4,2x,f3.2,2x,i13)
    end do
    close(unit=7)
    end program dat
Mais j'ai une erreur apres avoir fait 'compile' à la ligne 13.

Je ne sais pas comment faire pour résoudre mon exercice

Merci de votre aide