all right I’m trying to convert this Pascal code to C++ witch i can do i just need help with 2 functions
here is the Pascal code
Code:
//Returns the amount Of pixels between a1, b1 And a2, b2
Function Dist(a1, b1, a2, b2 : Integer) : Integer;
Var
aa, bb : Extended;
Begin
If(a1>a2)Then
aa:= (a1 - a2) * (a1 - a2)
Else
aa:= (a2 - a1) * (a2 - a1);
If(b1>b2)Then
bb:= (b1 - b2) * (b1 - b2)
Else
bb:= (b2 - b1) * (b2 - b1);
result:= trunc(Sqrt(aa + bb)) + 1;
End;
ok now i need help with a trunc function in C++ what it does i believe is takes away the decimal point from any number.
and the sqrt function witch is square root.