动画效果的HelloWorld程序2
思路:让字符依次消失,就是先退格(\b)删除然后用空格来替换。
1 #include<stdio.h>
2 int main()
3 {
4 printf("H");
5 Sleep(500);
6 printf("e");
7 Sleep(500);
8 printf("l");
9 Sleep(500);
10 printf("l");
11 Sleep(500);
12 printf("o ");
13 Sleep(500);
14 printf("W");
15 Sleep(500);
16 printf("o");
17 Sleep(500);
18 printf("r");
19 Sleep(500);
20 printf("l");
21 Sleep(500);
22 printf("d ");
23 Sleep(500);
24 printf("!");
25 Sleep(500);
26
27 printf("\b ");
28 Sleep(500);
29 printf("\b\b ");
30 Sleep(500);
31 printf("\b\b ");
32 Sleep(500);
33 printf("\b\b ");
34 Sleep(500);
35 printf("\b\b ");
36 Sleep(500);
37 printf("\b\b ");
38 Sleep(500);
39 printf("\b\b ");
40 Sleep(500);
41 printf("\b\b ");
42 Sleep(500);
43 printf("\b\b ");
44 printf("\b\b ");
45 Sleep(500);
46 printf("\b\b ");
47 Sleep(500);
48 printf("\b\b ");
49 Sleep(500);
50 printf("\b\b ");
51 Sleep(500);
52 printf("\b\b ");
53 Sleep(500);
54 printf("\b\b \b");
55 Sleep(500);
56 return 0;
57 }