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
35
36
37
#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 i, j, b, c;
char* string = (char*) malloc(sizeof (char)*STR_LENGTH);
printf("Input string: ");
scanf("%s", string);
system("cls||clear");
printf("%s", string);
set_timer(75);
int str_len = strlen(string);
for (i = 0; i < str_len; i++) {
for (j = 1; j <= HEIGHT; j++) {
system("cls||clear");
for (c = i + 1; string[c] != '\0'; c++) printf("%c", string[c]); //печатаем оставшуюся часть строки
for (b = 1; b <= j; b++) printf("\n");
printf("%c", string[i]); //целевой символ
set_timer(75);
}
system("cls||clear");
}
free(string);
return 0;
}