### POINTS ON A PLANE

Hey Guys,

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.

Thanks
Sorry, that's not enough info.

Have you tried logging what's going on with your logic, rather than doing the drawing, to help you figure out what's up?

Andy
Basically I have this function:

{
for ( int x = 9; x >= 0; x-- )
{
cout << setw( 3 ) << x << "|" << endl;
if( x = x1 )
cout << "X";
}

cout << "------------------------------------" << endl;

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.
Sorry dude.... :( right now i have no any idea for solving your problem.... :(
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:

 ``1234567891011121314`` ``````// 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 }``````
Last edited on
Topic archived. No new replies allowed.