/*
*
***
*****
*******
*********
***********
A
BCB
CCDCC
DDDEDDD
EEEEFEEEE
FFFFFGFFFFF
*/
#include "stdio.h"
void main(){
int i,j;
int n,m;
char op;
do{
printf("请输入行数:");
do{
m=0;
m=scanf("%d",&n);
if(m!=1||n<2){
printf("行数输入有误,请重输:");
fflush(stdin);
}
}while(m!=1||n<2);
for(i=1;i<=n;i++)
{
for(j=1;j<=n-i+10;j++)
printf(" ");
for(j=1;j<=i*2-1;j++)
{
if(j==1||j==i*2-1)
printf("%c",64+i);
else
printf(" ");
}
printf("
");
}
for(i=n-1;i>=1;i--){
for(j=1;j<=n-i+10;j++)
printf(" ");
for(j=1;j<=i*2-1;j++)
{
if(j==1||j==i*2-1)
printf("%c",64+i);
else
printf(" ");
}
printf("
");
}
printf("是否继续(y/n):");
fflush(stdin);//为了清除输入行数之后留在缓冲区的回车
do{
op=getchar();
if(op!='y'&&op!='Y'&&op!='n'&&op!='N'){
printf("只许输入y或n,请重输:");
fflush(stdin);//为了清除getchar()之后留在缓冲区的回车
}
}while(op!='y'&&op!='Y'&&op!='n'&&op!='N');
}while(op=='y'||op=='Y');
}