Newsgroup: it.comp.lang.pascal
Titolo: Parabola

Nn capisco cosa nn va in 'sto programma... ogni sorta di aiuto č ben accetta
(****************)
Program parabola;
uses crt;
var xf,xv,yf,yv,dirr,asse:array[1..2] of longint;
    a,b,c:longint;
function esp(base,esponente:longint):longint;
var ris,x:integer;
begin
ris:=1;
if esponente=0 then esp:=1 ;
if esponente>0 then begin
for x:=1 to esponente do
begin
    ris:=ris*base;
end;
esp:=ris;
end;
end;
function MCD(p:integer; q:integer):integer;
begin
  if(p>q)
  then MCD:=MCD(p-q,q)
  else if(p<q) then
         MCD:=MCD(p,q-p)
        else MCD:=p;
end;
function componi(p,q:longint):string;
var c:longint;
    stra,strb:string;
begin
c:=MCD(p,q);
p:=round(p/c);
q:=round(q/c);
if q=1 then begin
str(p,stra);
componi:=stra;
end;
if q<>1 then begin
str(p,stra);
str(q,strb);
componi:=stra+'/'+strb;
end;
end;
function asc_fuoco:string;
begin
xf[1]:=-b;
xf[2]:=2*a;
asc_fuoco:=componi(xf[1],xf[2]);
end;
function ord_fuoco:string;
begin
yf[1]:=(1-esp(b,2)-4*a*c);
yf[2]:=4*a;
ord_fuoco:=componi(yf[1],yf[2]);
end;
function asc_vertice:string;
begin
xv[1]:=-b;
xv[2]:=2*a;
asc_vertice:=componi(xv[1],xv[2]);
end;
function ord_vertice:string;
begin
yv[1]:=(-1-esp(b,2)-4*a*c);
yv[2]:=4*a;
ord_vertice:=componi(yv[1],yv[2]);
end;
function diret:string;
begin
dirr[1]:=(-1-esp(b,2)-4*a*c);
dirr[2]:=4*a;
diret:=componi(dirr[1],dirr[2]);
end;
function ax:string;
begin
asse[1]:=-b;
asse[2]:=2*a;
ax:=componi(asse[1],asse[2]);
end;
begin
write('a> ');
readln(a);
write('b> ');
readln(b);
write('c> ');
readln(c);
writeln(asc_fuoco);
readln;
end.
(***************************)

 ha scritto nel messaggio
news:Cmqk8.70938$Ns4.2...@news2.tin.it...


niente, scusate, già risolto. cmq per completezza posto il progz completo
Program parabola;
uses crt;
var xf,xv,yf,yv,dirr,asse:array[1..2] of integer;
    a,b,c:integer;
function esp(base,esponente:longint):integer;
var ris,x:integer;
begin
ris:=1;
if esponente=0 then esp:=1 ;
if esponente>0 then begin
for x:=1 to esponente do
begin
    ris:=ris*base;
end;
esp:=ris;
end;
end;
function MCD(p:integer; q:integer):integer;
begin
  if(p>q)
  then MCD:=MCD(p-q,q)
  else if(p<q) then
         MCD:=MCD(p,q-p)
        else MCD:=p;
end;
function componi(p,q:longint):string;
var c,kp,kq:integer;
    stra,strb:string;
begin
kp:=0;kq:=0;
if p<0 then begin p:=-1*p;kp:=1;end;
if q<0 then begin q:=-1*q;kq:=1;end;
c:=MCD(p,q);
p:=round(p/c);
q:=round(q/c);
if kp=1 then p:=-1*p;
if kq=1 then q:=-1*q;
str(p,stra);
str(q,strb);
if (q=1) or (q=(-1)) then begin
if q=(-1) then begin
   if stra[1]='-' then delete(stra,1,1);
   if stra[1]<>'-' then insert('-',stra,1);
end;
componi:=stra;
end
else begin
if strb[1]='-' then begin
if stra[1]='-' then begin delete(stra,1,1); delete(strb,1,1); end;
if stra[1]<>'-' then begin delete(strb,1,1); insert('-',stra,1); end;
end;
componi:=stra+'/'+strb;
end;
end;
function asc_fuoco:string;
begin
xf[1]:=-1*b;
xf[2]:=2*a;
asc_fuoco:=componi(xf[1],xf[2]);
end;
function ord_fuoco:string;
begin
yf[1]:=1-1*(esp(b,2)-4*a*c);
yf[2]:=4*a;
ord_fuoco:=componi(yf[1],yf[2]);
end;
function asc_vertice:string;
begin
xv[1]:=-1*b;
xv[2]:=2*a;
asc_vertice:=componi(xv[1],xv[2]);
end;
function ord_vertice:string;
begin
yv[1]:=-1*(esp(b,2)-4*a*c);
yv[2]:=4*a;
ord_vertice:=componi(yv[1],yv[2]);
end;
function diret:string;
begin
dirr[1]:=-1-1*(esp(b,2)-4*a*c);
dirr[2]:=4*a;
diret:=componi(dirr[1],dirr[2]);
end;
function ax:string;
begin
asse[1]:=-1*b;
asse[2]:=2*a;
ax:=componi(asse[1],asse[2]);
end;
begin
write('a> ');
readln(a);
write('b> ');
readln(b);
write('c> ');
readln(c);
writeln('F( ',asc_fuoco,' , ',ord_fuoco,' ) ');
writeln('V( ',asc_vertice,' , ',ord_vertice,' ) ');
writeln('d:y= ',diret);
writeln('asse:y = ',ax);
readln;
end.