I have two lines one horizontal and one vertical, I have the equations of lines in the format:

and
as it is a horizontal line and
for the vertical line and I can calculate
because I know a point from which the lines passes by.
I want to calculate the perpendicular distance of a point in
space from each of these lines. I can’t use the slop as it will give divide by 0 error. What is the other approach?
In the horizontal line the equation is
y = cand so the distance of any general point(a,b)from that line is simply|b-c|.In the vertical line,
cis meaningless as the line never crosses the y axis (unless it is the y axis). The equation of such a line isx = d(you need to calculate d) then the distance of a point(a,b)from this line is simply|a-d|EDIT: By the way this question really has nothing at all to do with C++