拉窗簾函式(動態列印字串)
阿新 • • 發佈:2018-12-10
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)