How do you know if the points are on one straight?
Require the coordinates of 4 points from the keyboard (x and y). How to write a condition that defines at least three of these points on one direct one?
You may use the straight equation through two points:
(x - x_1) / (x_2 - x1) = (y - y_1) / (y_2 - y_1)
If the equation is done for any other point, it is on this straight line.
UPD: In fact, for three points, the condition would look like:
if ((x_3 - x_1) / (x_2 - x_1) == (y_3 - y_1) / (y_2 - y_1)) /*Точки 1, 2, 3 - лежат на одной прямой */