1#include <stdio.h>
2#include <windows.h>
3
4#define COLOR_DEFAULT 7
5#define LIGHT_RED 12
6
7void setColor(int color);
8
9int main()
10{
11 setColor(LIGHT_RED);
12 printf("This text is red");
13 setColor(colorDefault);
14}
15
16void setColor(int color)
17{
18 HANDLE hConsole;
19 hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
20 SetConsoleTextAttribute(hConsole, color);
21}