
the value of a float variable is going to the wrong if condition.. doesnt matter if thats a 0 or a -1.. it is just going for the condidtion when variable is to +1

the value of a float variable is going to the wrong if condition.. doesnt matter if thats a 0 or a -1.. it is just going for the condidtion when variable is to +1
You need to use == instead of =.
In c++, assignment operator (=) returns the value equal to the assigned value (this allows writing something like a = b = c). That's why slope = 1 is equal to 1, which, when converted to bool, equals true, and so you end up entering the if section.
Your assigned value in condition, not check it. First you use == instead of =
There is a difference between = and ==. In your if statement you want to check the value, hence you should use ==.
if(slope == 1)
{
/*...*/
}
The following lines in your code are invalid:
if (slope = 0)
if (slope = +1)
if (slope = -1)
This is because you use the assignment operator = instead of the equality operator ==. As a result of this, your if-statements are not making the desired comparison between the slope and the values +1, 0, or -1.
If we have to compare 2 values, 2 variables, or a variable to a value in an if-statement, then we use the equality operator == to compare them over the =. There are a few exceptions to this; see the following page:
Variable assignment in “if” condition.
Just a side note, I would like to point out that you should use some more whitespace in your code; it helps make it more readable. Also, try posting the code itself in your question instead of posting a snapshot of it.
Good luck!