C++控制台字体颜色

来源:互联网 发布:加内特生涯数据 编辑:程序博客网 时间:2024/06/05 03:23

http://blog.csdn.net/exlsunshine/article/details/28440889


    #include <iostream>      #include <Windows.h>  //需要引用Windows.h      using namespace std;            int _tmain(int argc, _TCHAR* argv[])      {          HANDLE  hConsole;          hConsole = GetStdHandle(STD_OUTPUT_HANDLE);          for(int i=255;i>=0;i--)          {              SetConsoleTextAttribute(hConsole, i);              cout<<"what color is this?"<<endl;          }                cin.get();          return 0;      }  


0 0