# 输入一个正整数n(代表图形的行数),输出如样例形式的图形 输入:5 输出: ```json A ABA ABCBA ABCDCBA ABCDEDCBA ``` 以下程序实现了这一功能,请你填补空白处内容: ```cpp #include #include using namespace std; int main() { int N; cin >> N; for (int i = 0; i < N; i++) { for (int j = 0; j < N - i; j++) printf(" "); ______________________ printf("\n"); } return 0; } ``` ## template ```cpp #include #include using namespace std; int main() { int N; cin >> N; for (int i = 0; i < N; i++) { for (int j = 0; j < N - i; j++) printf(" "); for (int j = 0; j < i; j++) printf("%c", (char)(j + 'A')); for (int j = i; j >= 0; j--) printf("%c", (char)(j + 'A')); printf("\n"); } return 0; } ``` ## 答案 ```cpp for (int j = 0; j < i; j++) printf("%c", (char)(j + 'A')); for (int j = i; j >= 0; j--) printf("%c", (char)(j + 'A')); ``` ## 选项 ### A ```cpp for (int j = 0; j < i; j--) printf("%c", (char)(j + 'A')); for (int j = i; j = 0; j++) printf("%c", (char)(j + 'A')); ``` ### B ```cpp for (int j = 0; j < i; j--) printf("%c", (char)(j + 'A')); for (int j = i; j <= 0; j--) printf("%c", (char)(j + 'A')); ``` ### C ```cpp for (int j = 0; j < i; j--) printf("%c", (char)(j + 'A')); for (int j = i; j <= 0; j--) printf("%c", (char)(j - 'A')); ```