| deathseeker25 |
May 30th, 2005 3:38 PM |
Pascal doubt
Well i got a problem in this program i created....Some things are written in portuguese (my language) but i think they're not crucial to solve the problem....
:
Program FormulaResolvente;
uses
crt;
var
A : real;
B : real;
C : real;
D : real; {o k ta dentro da raiz kuadrada da formula resolvente}
X : real; {coordenada X do vertice}
raiz1 : real;
raiz2 : real;
Begin
clrscr;
writeln( 'Introduz o valor de A:' );
readln( A );
writeln( 'Introduz o valor de B:' );
readln( B );
writeln( 'Introduz o valor de C:' );
readln( C );
d:= (b*b)-(4*a*c);
if d < 0 then
writeln('Raizes de nºs negativos nao existem Razz')
else
raiz1:= (-b+sqrt(d))/(2*a);
raiz2:= (-b-sqrt(d))/(2*a);
BEGIN
writeln('1ª Raiz = ',raiz1);
writeln('2ª Raiz = ',raiz2);
END;
X:= (raiz1+raiz2)/2;
Begin
writeln('Coordenada X do vertice : ',X);
writeln('Coordenada Y do vertice : ',(A*sqr(x))+(B*X)+C);
while not keypressed do;
end;
end.
Ok, I´ll say what the problem is: the command "while not keypressed do" just function when D<0..well that's a real big problem because D can also be >0 and then the window closes before showing the coordinate of the vertex of the parable....
Please help me, 'cause I'd want to start doing another program in Pascal and i wnat to finish this today...
Thx
|