Change foreground & background color of text using Visual Studio C++

Gallery

#include <iostream>#include <windows.h> using namespace std; int main(){  HANDLE  hConsole;   hConsole = GetStdHandle(STD_OUTPUT_HANDLE);  for(int i = 0; i < 255; i ++)  {    SetConsoleTextAttribute(hConsole, i);    cout<<i<<“\t This is testing string…”<<endl;  }  return 0;} Advertisements