#include <Windows.h> #include <stdio.h> #include <iostream> using namespace std; int main() { HANDLE hOut; hOut = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleTextAttribute(hOut, FOREGROUND_RED | FOREGROUND_GREEN); cout << "This text is yellow." << endl; SetConsoleTextAttribute(hOut, FOREGROUND_GREEN | FOREGROUND_BLUE); cout << "This text is cyan." << endl; SetConsoleTextAttribute(hOut, FOREGROUND_BLUE | FOREGROUND_RED); cout << "This text is magenta." << endl; SetConsoleTextAttribute(hOut, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); cout << "This text is white." << endl; return 0; }
时间: 2024-10-10 16:03:57