作者:yunjinqi 类别:
日期:2023-05-31 16:40:02
阅读:445 次 消耗积分:0 分
#include <stdio.h>
int main(){
char alpha_arr[26] = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char c;
char alpha;
// int count=0;
if (scanf("%c",&c)!=EOF){
for (int i=0;i<26;i++){
alpha = alpha_arr[i];
// printf("%c %c\n",alpha,c);
if (alpha<c){
if (i==0){
// 打印39个空格
for (int j=0;j<39-i;j++){
printf("%c",' ');
}
printf("%c\n",alpha);
}else{
// 打印开始的空格
for (int j=0;j<39-i;j++){
printf("%c",' ');
}
// 打印字母
printf("%c",alpha);
// 打印中间空格
for (int j=0;j<2*i-1;j++){
printf("%c",' ');
}
// 打印字母
printf("%c\n",alpha);
}
}
if (alpha==c){
for (int j=0;j<39-i;j++){
printf("%c",' ');
}
for (int j=0;j<2*i+1;j++){
printf("%c",alpha);
}
}
}
}
else{
printf("input wrong");
}
return 0;
}