#include <iostream>
#include "windows.h"
usingnamespace std;
int main()
{
int x = 2;
int y = 2;
cout << "line0" << endl;
cout << "line1" << endl;
cout << "line2" << endl;
cout << "line3" << endl;
COORD coord;
coord.X = x; // your X cord
coord.Y = y; //your Y cord
SetConsoleCursorPosition(GetStdHandle( STD_OUTPUT_HANDLE ),coord);
}
So you're saying that your code doesn't compile? It sounds like it doesn't know about the definition of the COORD struct in "WinCon.h" (which is included by "Windows.h"). Can you try this code out and see if it works?
That works for me. I tried something else: putting #include "windows.h" in the file that needed it fixed the problem. Why would this work but not including it from another file (windows.h is the first file that is included)?