#include<stdio.h> #include<string.h> #include<windows.h> #include<time.h>
int main() { ?? ?char arr1[] = "nulixuexi, gaibianshenghuo"; ?? ?char arr2[] = "##########################"; ?? ?int a = 0; ?? ?int b = strlen(arr1)-1; ?? ?printf("%s\n", arr2); ?? ?//while语句实现 ?? ?while (a <= b) ?? ?{ ?? ??? ?Sleep(1000); ?? ??? ?arr2[a] = arr1[a]; ?? ??? ?arr2[b] = arr1[b]; ?? ??? ?a++; ?? ??? ?b--; ?? ??? ?printf("%s\n", arr2); ?? ?} ?? ?//for语句实现 ?? ?for (;a <= b;a++, b--) ?? ?{ ?? ??? ?Sleep(1000); ?? ??? ?arr2[a] = arr1[a]; ?? ??? ?arr2[b] = arr1[b]; ?? ??? ?printf("%s\n", arr2); ?? ?} ?? ?return 0; }
|