program test; uses wincrt; type book = record num_isbn:string[20]; title:string[20]; paru:integer; edition:string[20]; end; bookee = array[1..99]of book; cpt = array[1..99]of integer; type personne = record num_id:integer; nom:string[15]; prenom:string[15]; nation:string[20]; date_dec:integer; etat:string[20]; nbre_ouvr:integer; list_ouvr:bookee; end; fp=file of personne; var author:array[1..99] of personne; r:fp; procedure add(var f:fp); var r,i,j,d,num,n:integer; begin //verification of file assign (f, 'E:\auteur.dat'); {$i-} reset (f); {$i+} if ioresult<>0 then rewrite(f); //debut writeln('how many of records'); readln(r); for i:=1 to r do begin num:=filesize(f); writeln(' Num ID',num); readln(author[i].num_id); writeln(' Name',num); readln(author[i].nom); writeln(' prenom',num); readln(author[i].prenom); writeln(' Nation',num); readln(author[i].nation); writeln('entrez le nombre d''oeuvres '); readln(n); author[i].nbre_ouvr:=0; for j:=1 to n do begin author[i].nbre_ouvr := author[i].nbre_ouvr + 1; writeln('# entrez le numero ID'); readln(author[i].list_ouvr[j].num_isbn); writeln(' entrez le titre'); readln(author[i].list_ouvr[j].title); writeln(' entrez l''annee de parution '); readln(author[i].list_ouvr[j].paru); writeln(' entrez le nom de la maison d''edition : '); readln(author[i].list_ouvr[j].edition); writeln;writeln; write(f,author[i]); end; end; close(f); end; procedure see(var f:fp); var j:integer; isbn:string[20]; begin writeln('entrez le numero ISBN'); readln(isbn); assign (f, 'E:\auteur.dat'); reset(f); j:=1; while not (EOF(f)) do begin read(f,author[j]); if ( author[j].list_ouvr[j].num_isbn = isbn) then begin writeln(j,' .Name:', author[j].nom,'prenom :', author[j].prenom); writeln(' .Numero ISBN :', author[j].list_ouvr[j].num_isbn ,'LE TITRE :', author[j].list_ouvr[j].title); writeln('Nombre d''ouvrages : ',author[j].nbre_ouvr); inc(j); end; end; if j=1 then writeln('Aucun resultat '); close(f); end; procedure add_livre(var f:fp); var id,j,e:integer; d:longint; begin writeln('entrez le numero ID de l''auteur'); readln(id); assign (f, 'E:\auteur.dat'); reset(f); j:=1; while not (EOF(f)) do begin read(f,author[j]); if ( author[j].num_id = id) then begin author[j].nbre_ouvr := author[j].nbre_ouvr +1; e:= author[j].nbre_ouvr; writeln(' entrez le numero ID'); readln(author[j].list_ouvr[e].num_isbn); writeln(' entrez le titre'); readln(author[j].list_ouvr[e].title); writeln(' entrez l''annee de parution '); readln(author[j].list_ouvr[e].paru); writeln(' entrez le nom de la maison d''edition : '); readln(author[j].list_ouvr[e].edition); write(f,author[j]); inc(j); end; end; if j = 1 then writeln('Aucun resultat '); close(f); end; begin writeln('--Add an author--'); //add(r); see(r); //add_livre(r); readln; end.