Created
July 31, 2018 03:09
-
-
Save chessai/96fe1095267713cc02d27781d7cc02c8 to your computer and use it in GitHub Desktop.
sad.c
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 <stdio.h> | |
#include <unistd.h> | |
#include <string.h> | |
#include <time.h> | |
#include <stdlib.h> | |
const char* RESET = "\x1B[0m"; | |
const char *COLORS[] = { "\x1B[31m", "\x1B[32m", "\x1B[33m", "\x1B[34m", "\x1B[35m", "\x1B[36m" }; | |
int main() { | |
srand(time(NULL)); | |
for(;;) { | |
int colorIdx = rand() % 6; | |
printf("%s:(%s", COLORS[colorIdx], RESET); | |
int spacing = rand() % 10; | |
for(int i = 0; i < spacing; i++) { | |
printf(" "); | |
} | |
fflush(stdout); | |
usleep(5000); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment