I need help writing a code that will allow me to take in x and y coordinates
and display the points on a plane. I need some advice. I am trying to look
at each point on the plane individually and either placing a marker "X" there
or just a space depending on if it equals the the user's input. The problem is that it is placing an X at the x-coord and one at the y-coord, not the ordered pair.
for ( int x = 0; x <= 9; x++)
{
if( x == 0 )
cout << " | ";
cout << setw( 3 ) << x;
}
cout << endl;
}
Which simply displays the plane ( y and x axis ). I am still very new at this, but I don't know any other way to go about it. From here I need to figure out how to display an X at the user's ordered pair. I take in the user's coordinates in main and pass them in. I just feel as though I am attacking the process of displaying the plane the wrong way.
Try reworking your code so you use two nested for loops -- for the x and y coord -- and use the position to decide what char to o/p. With just the axes (no X marks the spot)
Then add code to mark the point!
Something along the line of:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
// Enough is ENOUGH! I have had it with these mother****in'
// points on this mother****in' plane! Everybody strap in!
// I'm about to display some ****in' chars.
for ( int y = 9; y >= -9; y-- ) // adjust scale to taste
{
for ( int x = -9; x <= 9; x++ )
{
// decide char char to display
// display it!
}
// etc
}