zz控制台程序中输入彩色字符

先帖一个C++的

cpp代码
  1. #include <windows.h> 
  2. #include <iostream> 
  3. using namespace std;   
  4. void SetColor(unsigned short ForeColor=4,unsigned short BackGroundColor=0)   
  5. {   
  6.      HANDLE hCon=GetStdHandle(STD_OUTPUT_HANDLE);   
  7.      SetConsoleTextAttribute(hCon,ForeColor|BackGroundColor);   
  8. }   
  9.  
  10. int main()   
  11. {   
  12.      SetColor();   
  13.      std::cout<<"Hello world!"< SetColor(40,30);   
  14.      std::cout<<"Hello world!"return 0;   
  15. }  

阅读全部内容…

Tags: c++, python