B
#include <windows.h>
void ClearScreen(void)
{
CONSOLE_SCREEN_BUFFER_INFO csbi;
COORD target = {0, 0};
DWORD written;
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
FillConsoleOutputCharacter(GetStdHandle(STD_OUTPUT_HANDLE), ' ',
csbi.dwSize.X * csbi.dwSize.Y,
target, &written);
FillConsoleOutputAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7,
csbi.dwSize.X * csbi.dwSize.Y,
target, &written);
}
void SetCursorPosition(int x, int y)
{
COORD pos = {x, y};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}
void DruckSimpleText(int x, int y, char const *text)
{
COORD target = {x, y};
DWORD written;
WriteConsoleOutputCharacter(GetStdHandle(STD_OUTPUT_HANDLE), text,
strlen(text),
target, &written);
}
void DruckSimpleChar(int x, int y, char c)
{
char text[2] = {c, 0};
DruckSimpleText(x, y, text);
}
int main()
{
int y;
ClearScreen();
SetCursorPosition(0, 0);
for(y = 3; y < 13; )
{
DruckSimpleChar(5, y, ' ');
++y;
DruckSimpleChar(5, y, 'X');
Sleep(1000);
}
}