-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconsole.cpp
More file actions
30 lines (27 loc) · 770 Bytes
/
Copy pathconsole.cpp
File metadata and controls
30 lines (27 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include"console.h"
void gotoXY(int x, int y)
//toa do
{
COORD co = { x, y };
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), co);
}
void TextColor(int x)
//Xac dinh mau cua chu
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), x);
}
void clrscr()
//xoa trang man hinh
{
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
HANDLE hConsoleOut;
COORD Home = { 0,0 };
DWORD dummy;
hConsoleOut = GetStdHandle(STD_OUTPUT_HANDLE);
GetConsoleScreenBufferInfo(hConsoleOut, &csbiInfo);
FillConsoleOutputCharacter(hConsoleOut, ' ', csbiInfo.dwSize.X * csbiInfo.dwSize.Y, Home, &dummy);
csbiInfo.dwCursorPosition.X = 0;
csbiInfo.dwCursorPosition.Y = 0;
SetConsoleCursorPosition(hConsoleOut, csbiInfo.dwCursorPosition);
}
//tham khao