Color funtion in Visual C++ and other non-Turbo C Compilers
Monday, October 31, 2011
In Turbo C and Turbo C++, there are so many functions (colors, gotoxy and etc...) that you can't find in devC++ and other non Turbo Compilers. However, you can make your own function. Here:
For Colors:
void setcolor(unsigned short color)
{
HANDLE hcon = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hcon,color);
}
Note that you should include a windows header in your source codes. By the way, you can use the system function, sorry I can't recall the codes but the codes above is much better because you can also change the background color of your program.
Sharing is so Easy: |
Labels:
C Programming,
C++