From 28425a3b9177749b2650a5e9c70043287a58f5bc Mon Sep 17 00:00:00 2001 From: Louie Date: Sun, 9 Feb 2020 05:36:39 +0000 Subject: first commit --- congrats_animation.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 congrats_animation.c diff --git a/congrats_animation.c b/congrats_animation.c new file mode 100644 index 0000000..34a1905 --- /dev/null +++ b/congrats_animation.c @@ -0,0 +1,45 @@ +#include +#include +#define DISTANCE 10 +#define DOWNTIME 100000 + +int main(){ + int i, j; + + while(1){ + for(i = 0; i < DISTANCE; i++){ + for(j = 0; j < 15+i+1; j++){ + printf("\b \b"); //backspace + } + for(j = 0; j < i; j++){ + printf(" "); + } + printf("Congratulations"); + fflush(stdout); + usleep(DOWNTIME); + } + + i--; + + while(i > 1){ + + for(j = 0; j < 15+i; j++){ + printf("\b \b"); //backspace + fflush(stdout); + } + + i--; + + for(j = 0; j < i; j++){ + printf(" "); + } + printf("Congratulations"); + fflush(stdout); + usleep(DOWNTIME); + } + } + + printf("\n"); + + return 1; +} -- cgit