I am trying to create a text based graphing program and I am running in to some trouble. My trouble isn't so much with the programming its with one particular algorithm in creating the points.
So, here is sample of what the graph will look like with points included.
(y scale runs along horizontal, x on vertical)
p1 = 1,1 p2 = 2,2 p3 = 3,3 1.0 2.0 3.0 1.0+-------+-------+ |o | | 2.0+ o | | | 3.0+ o
I have the line to the right of the | or + set up as a character array that is 16 in size. How should I go about putting the o in the correct spot? I am thinking about setting it up as some sort of percentage and then converting that number to an integer and using that integer in the array as follows: char[numconverted] = 'o', but I can't figure out how I would go about calculating the percentage. Obviously, my graph isn't that small, either so, this would have to work on any size character array.
Edited 3 Years Ago by tensity