Advertisement
Kolyach

4.4

Oct 8th, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <cmath>
  4. #include <fstream>
  5. #include<windows.h>
  6.  
  7. using namespace std;
  8.  
  9. enum ConsoleColor
  10. {
  11.     Black = 0,
  12.     Blue = 1,
  13.     Green = 2,
  14.     Cyan = 3,
  15.     Red = 4,
  16.     Magenta = 5,
  17.     Brown = 6,
  18.     LightGray = 7,
  19.     DarkGray = 8,
  20.     LightBlue = 9,
  21.     LightGreen = 10,
  22.     LightCyan = 11,
  23.     LightRed = 12,
  24.     LightMagenta = 13,
  25.     Yellow = 14,
  26.     White = 15
  27. };
  28.  
  29. void SetColor(ConsoleColor text, ConsoleColor background)
  30. {
  31.     HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
  32.     SetConsoleTextAttribute(hStdOut, (WORD)((background << 4) | text));
  33. }
  34.  
  35. int main()
  36. {
  37.     int i;
  38.     for (i=0; i < 21; i++) {
  39.         SetColor(Blue, Blue);
  40.         cout << "                      ";
  41.         SetColor(Yellow, Yellow);
  42.         cout << "                      ";
  43.         SetColor(Red, Red);
  44.         cout << "                      " << endl;
  45.     }
  46.     SetColor(White,Black);
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement