编写一段代码,实现演示多个字符从两端移动,向中间汇聚

编写一段代码,实现演示多个字符从两端移动,向中间汇聚

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <Windows.h>//Sleep()的主函数
#include <stdlib.h>//system()的主函数
int main()
{
char arr1[] = “welcome to ShenZhen!!!”;
char arr2[] = “#####################”;
int left = 0;
int right = strlen(arr1) - 1;
while (left <= right)
{
arr2[left] = arr1[left];
arr2[right] = arr1[right];
printf("%s\n", arr2);
Sleep(1000);//输出完之后休息一秒
system(“cls”);//清屏函数
left++;
right–;
}
printf("%s\n", arr2);
system(“pause”);
return 0;
}

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_54748281/article/details/113484730