summaryrefslogtreecommitdiff
path: root/congrats_animation.c
diff options
context:
space:
mode:
Diffstat (limited to 'congrats_animation.c')
-rw-r--r--congrats_animation.c45
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;
+}