Coordinating system in console c++? -
i don't know wheres error. looks forgot basic stuff.
int xy [2]; cout << "input x: "; cin >> xy[0]; cout << "\ninput y: "; cin >> xy[1]; ( int y = 0; y < 10; y++ ) { ( int x = 0; x < 10; x++) { if ( x = xy[0] + 5 && y == xy[1] + 5) { cout << "°"; } else { cout << "+"; } } cout << "\n"; }
may missed :
if ( x == xy[0] + 5 && y == xy[1] + 5) ^ equality
which why you're getting infinite loop
=
assignment operator , while ==
used check equality
putting x= xy[0] + 5
assigns x value , rather comparing hence never ending inner loop
Comments
Post a Comment