一个拉窗帘的小练习,见笑了,不过我很满意,感觉起到了渐变的效果.
渐变的语句为:welcome to the world !
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<Windows.h>
int main() {
char str1 [] = "welcome to the world!";
char str2 [] = "---------- ----------";
int left = 0;
int right = strlen(str1) - 1;
while (left <= right) {
printf("%s\n", str2);
str2[left] = str1[left];
str2[right] = str1[right];
++left; --right;
Sleep(100);
system("cls");
}
system("pause");
return 0;
}