Code:
#include <iostream.h>
#include <windows.h>
HANDLE hStdOut;//need handle to console output
void clrscr()
{
COORD coordScreen = { 0, 0 };
DWORD cCharsWritten;
CONSOLE_SCREEN_BUFFER_INFO csbi;
DWORD dwConSize;
GetConsoleScreenBufferInfo(hStdOut, &csbi);
dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
FillConsoleOutputCharacter(hStdOut, TEXT(' '), dwConSize, coordScreen, &cCharsWritten);
GetConsoleScreenBufferInfo(hStdOut, &csbi);
FillConsoleOutputAttribute(hStdOut, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten);
SetConsoleCursorPosition(hStdOut, coordScreen);
}
void gotoxy(int x, int y)
{
COORD coord;
coord.X = x;
coord.Y = y;
SetConsoleCursorPosition(hStdOut, coord);
}
int main(){
hStdOut = GetStdHandle(STD_OUTPUT_HANDLE); //Grab console out stream
clrscr(); //clear console
for(int x = 0;x<10;x++){
gotoxy(x+10,x+1);
cout << "Hello World" << endl;
}
return 0;
}
I dont have time to go through your code, but here is a quick example of how you can implement functions like clrscr() & gotoxy() in M$VC++....
They are not difficult....its just that you must recreate the functions yourself cuz M$ dont provide a library with them in.
How I manageged to recreate this code so quickly is because this stuff is listed in the "programmer's Faqs" for this site.....have a look before you post next time.
P.S. I know this is the C Board and I have used C++....I forgot where I was