ACTeeMo
这个回复框很烂,你复制出去格式化下#include <stdio.h>// 多次打印函数,参数:行数, 每一行的字符数量, 字符void multiPrintf(int height, int times, char str){int i;// 打印空格for (i = 0; i < (height - times) / 2; i++){printf("%s", " ");}// 打印字符for (i = 0; i < times; i++){printf("%c", str);}printf("\n");}int printPic(int height){int mid = (height + 1) / 2;// 画'|',对应奇数位,到中间值最大,启示数量为1,每次+4int i;for (i = 1; i <= height; i++){// 奇数位符号为|偶数位为*char str = (i % 2 != 0) ? '|' : '*';// 小于中值递增if (i < mid){multiPrintf(height, 2 * i - 1, str);}// 大于中值递减elsemultiPrintf(height, 2 * (height + 1 - i) - 1, str);}}int main(int argc, char const *argv[]){/* code */printPic(21);return 0;}