Why am I always = 0? Some class X and Y members are integers
Float mill slope (some class A, some class B) {float M = (AA-BI) / (A. X-bx); Cout & lt; & Lt; "M =" & lt; & Lt; M & LT; & Lt; "\ N"; Refund M; } is an integer division, then the result, which is an integer < / Em>, is assigned as a float. If the result is less than 1, then it ends in 0. You want to float before splitting the expression, e.g.
float m = (float) (AI - by) / (float) (f - bx);
Comments
Post a Comment