当前位置:网站首页>Two end carry output character

Two end carry output character

2022-06-11 20:28:00 csdn_ one thousand nine hundred and ninety-seven

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <windows.h>
#include <string.h>


int main()
{
    char arr1[] = { "hallo world!" };
    char arr2[] = { "############" };
    int left = 0;
    int right = strlen(arr1) - 1;
   
    while (left<=right)
    {   printf("%s\n", arr2);
        arr2[left] = arr1[left];
        arr2[right] = arr1[right];
        left++;
        right--;
        Sleep(1000);// Sleep for a second 
       system("cls");// Clear the screen 
    }
    printf("%s\n", arr2);
    return 0;
}

原网站

版权声明
本文为[csdn_ one thousand nine hundred and ninety-seven]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/03/202203011747008220.html