#include<stdio.h> int main() { char arr1[] = "*************"; char arr2[] = " "; int len = strlen(arr1); int mid1 = strlen(arr1) / 2; int mid2 = strlen(arr1) / 2; while (mid1 < len) { arr2[mid1] = arr1[mid1]; mid1++; arr2[mid2] = arr1[mid2]; mid2--; printf("%s\n", arr2); } char arr3[] = "*************"; char arr4[] = " "; int start = 0; int end = strlen(arr1) - 1; while (start < strlen(arr1) / 2) { arr1[start] = arr4[start]; start++; arr1[end] = arr4[end]; end--; printf("%s\n", arr1); } return 0; }
时间: 2024-11-05 01:23:08