Skip to content

Instantly share code, notes, and snippets.

@a-a
Created July 31, 2018 10:30
Show Gist options
  • Save a-a/455e09ca4ab508c0ea68236b73b7efe9 to your computer and use it in GitHub Desktop.
Save a-a/455e09ca4ab508c0ea68236b73b7efe9 to your computer and use it in GitHub Desktop.
:(
#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