slope of a line

I’m new to trigonometry and math and i’m studing it.
For practice i’m creating a c++ program that gets the points of a line (as input)and calculates the direction or slope of this line(as output).
I’m trying to use the trigonometry but without success because i wish calculate the slope of the line for each point with the tangent.
My key problem is that if i create a vector from the origin to the point and calculate the tangent for each vector of this type i get wrong results, but this is related to take the origin as start point.
How i can calculate the slope of a line from his points?
That are not ordered.