Windows C settings Console text output color (can be used as a test)

Source: Internet
Author: User

#include <windows.h>#defineRED 0x0004#defineGREEN 0x0002#defineBLUE 0x0001#defineWhite red| green| BLUE#defineYELLOW red| GREEN#definePINK red| BLUE#defineTurquoise blue| GREEN#defineBg_red 0x0040#defineBg_green 0x0020#defineBg_blue 0x0010#defineBg_white Bg_red|bg_green|bg_blue#defineBg_yellow Bg_red|bg_green#defineBg_pin Kbg_red|bg_blue#defineBg_turquoise Bg_blue|bg_green#defineHIGHLIGHT 0x0008HANDLE HOut=:: GetStdHandle (Std_output_handle);voidConsole_color (intColorinthighlight=0) {setconsoletextattribute (hOut, Color+highlight);}intMain () {puts ("Normal");    Console_color (RED, HIGHLIGHT); Puts ("Red text");    Console_color (GREEN); Puts ("Green Text");    Console_color (BLUE); Puts ("Blue text");    Console_color (white); Puts ("Normal"); return 0;}

Windows C settings Console text output color (can be used as a test)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.