2023年8月21日,周一下午
#include <Windows.h>
#include <iostream>
int main()
{
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
// 设置文本颜色为绿色
SetConsoleTextAttribute(hConsole, FOREGROUND_GREEN);
std::cout<<"This text is green!\n"<<std::endl;
// 恢复默认颜色
SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
std::cout<<"This text is normal!\n"<<std::endl;
return 0;
}