Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <cmath>
- #include <fstream>
- #include<windows.h>
- using namespace std;
- enum ConsoleColor
- {
- Black = 0,
- Blue = 1,
- Green = 2,
- Cyan = 3,
- Red = 4,
- Magenta = 5,
- Brown = 6,
- LightGray = 7,
- DarkGray = 8,
- LightBlue = 9,
- LightGreen = 10,
- LightCyan = 11,
- LightRed = 12,
- LightMagenta = 13,
- Yellow = 14,
- White = 15
- };
- void SetColor(ConsoleColor text, ConsoleColor background)
- {
- HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
- SetConsoleTextAttribute(hStdOut, (WORD)((background << 4) | text));
- }
- int main()
- {
- int i;
- for (i=0; i < 21; i++) {
- SetColor(Blue, Blue);
- cout << " ";
- SetColor(Yellow, Yellow);
- cout << " ";
- SetColor(Red, Red);
- cout << " " << endl;
- }
- SetColor(White,Black);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement