实现字符替换并打印
#define _CRT_SECURE_NO_WARNINGS 1#include<stdio.h>#include<string.h>#include<windows.h>#include<stdlib.h>int main(){ char arr1[] = { "welcome to c world, keep runing !!!"}; char arr2[] = { "***********************************" }; int left = 0; int right = strlen(arr1)-1;//strlen()函数是用来计算字符串长度的 while (left <= right) { arr2[left] = arr1[left]; arr2[right] = arr1[right]; printf("%s\n", arr2); Sleep(1000);//暂停一秒,1000毫秒等于一秒 system("cls");//执行系统命令的一个函数-cls-清空屏幕 left++; right--; } printf("%s\n", arr2); return 0;}