Hello, I have this code:
#include <iostream>
#include <windows.h>
using namespace std;
bool gotoxy(const WORD x, const WORD y) {
COORD xy;
xy.X = x;
xy.Y = y;
return SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), xy);
}
int main() {
system("MODE CON COLS=20 LINES=30");
gotoxy(0, 29);
for(int i=0; i < 20; ++i) {
cout << "a";
}
return 0;
}
This code works fully, with a problem: 'a' characters are not printed on the last line but on the penultimate one. I think this behavior is due to a line break that is inserted. Does anyone know a way to get around this behavior? Thanks!