sleep方法动态打印 C语言
1 #include<Windows.h> 2 #include<stdio.h> 3 #include<stdlib.h> 4 #include<string.h> 5 6 int main(){ 7 8 char cartain[] = "I really very love you!"; 9 char cartain1[] = "***********************"; 10 int i; 11 int j=0; 12 printf("**********************\n"); 13 /*printf("%d\n", strlen(cartain)); 14 printf("%d\n", strlen(cartain1));*/ 15 /*22*/ 16 i = sizeof(cartain) / sizeof(cartain[0])-1; 17 /*i = strlen(cartain);*/ 18 /*23,用sizeof计算字符串长度包含\0*/ 19 while(j<i){ 20 21 cartain1[j] = cartain[j]; 22 cartain1[i] = cartain[i]; 23 Sleep(100); 24 printf("%s\n", cartain1); 25 26 i--; 27 j++; 28 29 } 30 /*printf("%d\n", cartain[i]);*/ 31 32 system("pause"); 33 return 0; 34 }
//用windows函数库
//sleep(300)