Hi! I'm making a C++ program in which i have to take two coordinate input from the user on x-y plane and plot a simple graph joining those two coordinates. Now there are few problems that i am facing

1)the X and Y axis have to extend or increase their length in accordance with the users input (what I thought was to make a fixed X-Y axis of length 5 but if any of the input co-ordinates is 10 the line will exceed the out of the graph.)

2)another problem is of over lapping that if the line is completely over X or Y axis or even some point of that line crosses X and Y axis from a point at that point the character I'm using for representing the line e.g(*) should be displayed not the character im making my X(-) and Y(|) with.

(exact question for the Code):

Write a C++ code that takes as input two coordinates (x,y). The program then calculates an approximate linear equation (gradient and intercept are integers) and plots it onto the console. If the line interacts with x or y axis, make sure that axis is visible. Assume that the line cannot be vertical

examples of program output:

.

P.S I'm a beginner at programming so the things I'm supposed to use are basic (while, for, pre-defined functions, if, if else).THANKS.