{*************************************************************

               Le CyberZo‹de Qui Fr‚tille

  http://www.multimania.com/cyberzoide/info/turbo/turbo.htm
               cyberzoide@multimania.com

***************************************************************}


program tp1exo1;
uses crt;

const a0=2;
      a1=8.12E-03;
      a2=-1.2E-06;
      t0=0;
      tm=630;

procedure saisie(var ti, tf, past:real);
begin
repeat
write('Entrez Ti [',t0,',',tm,'] : ');
readln(ti);
until (ti>=t0) and (ti<=tm);
repeat
write('Entrez Tf>Ti [',t0,',',tm,'] : ');
readln(tf);
until (tf>=t0) and (tf<=tm) and (tf>ti);
write('Entrez le pas PAST : ');
readln(past);
end;

procedure calculaffiche(var t, r:real; ti, tf, past:real);
var i:integer;
begin
t:=ti;
repeat
r:=a0+a1*t+a2*sqr(t);
writeln('T=',t,' et R=',r);
inc(i);
if (i mod 20)=0 then
   begin
   readln;
   clrscr;
   end;
t:=t+past;
until t>=tf;
end;

var ti, tf, past, t, r:real;
    k:char;

BEGIN
repeat
saisie(ti, tf, past);
calculaffiche(t, r, ti, tf, past);
repeat
write('Recommencer le programme avec un nouveau jeu de calcul [O/N] ?');
readln(k);
k:=upcase(k);
until (k='O') or (k='N');
until k='N';
END.