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

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.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;

and the sqrt function witch is square root.