Solved Error: Incompatible types: got

September 27, 2012 at 05:45:03
Specs: Windows 7
var a,b,d,c,r,n : integer;

BEGIN
writeln('vuvedi 4islo'); readln(a);
writeln('vuvedi 4islo'); readln(b);
writeln('vuvedi 4islo'); readln(c);
n:=(a*a)-(4*b*c);
r:=(-b+sqrt(n))/(2*a);
d:=(-b-sqrt(n))/(2*a);
writeln('rezultata e ', r , d);
readln;
END.

that is on pascal and here are the errors:

9 / 19 untitl~1.pas
Error: Incompatible types: got "S80REAL" expected "LONGINT"
10 / 19 untitl~1.pas
Error: Incompatible types: got "S80REAL" expected "LONGINT"
14 untitl~1.pas
Fatal: There were 2 errors compiling module, stopping



See More: Error: Incompatible types: got

Report •

#1
September 27, 2012 at 11:02:06
✔ Best Answer
The sqrt() function returns a real, not an int. Pascal is very strict about types.

Report •
Related Solutions


Ask Question