diff options
author | Louie <lshprung@yahoo.com> | 2020-02-09 05:36:39 +0000 |
---|---|---|
committer | Louie <lshprung@yahoo.com> | 2020-02-09 05:36:39 +0000 |
commit | 28425a3b9177749b2650a5e9c70043287a58f5bc (patch) | |
tree | dc7af5a58be59572b93b7cd831f1e9f46c4bba43 /congrats_animation.c |
first commit
Diffstat (limited to 'congrats_animation.c')
-rw-r--r-- | congrats_animation.c | 45 |
1 files changed, 45 insertions, 0 deletions
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 <stdio.h> +#include <unistd.h> +#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; +} |