#include "stdafx.h"
#include <Windows.h>
//http://www.duote.com/tech/5/14702.html 颜色值
int _tmain(int argc, _TCHAR* argv[])
{
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE); // 获取控制台句柄
SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | FOREGROUND_RED); // 设置为红色
printf("把这句话颜色变成红色\n");
SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN);// 设置为黄色
printf("把这句话颜色变成黄色\n");
system("pause");
return 0;
}
C语言改变控制台输出内容颜色
最新推荐文章于 2025-06-02 12:48:58 发布