include stdio include stdlib include string include time define get_ti

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#define get_time() (long)((clock()/(float)CLOCKS_PER_SEC)*1000)
#define STR_LENGTH 80
#define HEIGHT 5
void set_timer(long msc) {
long start = get_time();
while ((get_time() - start) < msc);
}
int main(int argc, char** argv) {
int j, b;
char* string = (char*) malloc(sizeof (char)*STR_LENGTH);
printf("Input string: ");
scanf("%s", string);
system("cls||clear");
printf("%s", string);
set_timer(750);
while (*(string++) != '\0')
for (j = 1; j <= HEIGHT; j++) {
system("cls||clear");
printf("%s", string); //печатаем строку без первого символа
for (b = 1; b <= j; b++) printf("\n");
printf("%c", string[-1]); //печатаем первый символ
set_timer(750);
}
free(string);
return 0;
}