Created
July 31, 2018 10:30
-
-
Save a-a/455e09ca4ab508c0ea68236b73b7efe9 to your computer and use it in GitHub Desktop.
:(
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdafx.h" | |
#include <stdio.h> | |
#include <time.h> | |
#include <chrono> | |
#include <thread> | |
#include <Windows.h> | |
void SetColorAndBackground(int ForgC, int BackC = 0) { | |
WORD wColor = ((BackC & 0x0F) << 4) + (ForgC & 0x0F); | |
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), wColor); | |
} | |
int main() { | |
srand(time(NULL)); | |
for (;;) { | |
int colorIdx = rand() % 15; | |
SetColorAndBackground(colorIdx, 0); | |
printf(":("); | |
int spacing = rand() % 20; | |
for (int i = 0; i < spacing; i++) { | |
printf(" "); | |
} | |
fflush(stdout); | |
std::this_thread::sleep_for(std::chrono::milliseconds(3)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment