找出 .
符号的规律,根据规律循环AC。
#include<iostream>
using namespace std;
int main()
{
int n,i,j,k,l;
cin>>n;
char ch='A',sh='.',zh;
for (i=0,j=n-2;i<n-1,j>=0;i++,j--)
{
for (k=0;k<i;k++)
cout<<sh;
cout<<ch;
for (l=j;l>0;l--)
cout<<sh;
cout<<ch;
for (l=j;l>0;l--)
cout<<sh;
cout<<ch;
for (k=0;k<i;k++)
cout<<sh;
ch++;
cout<<endl;
}
ch='A';
for (i=0;i<n-1;i++)
{
cout<<ch;
ch++;
}
zh=ch;
for (i=0;i<n;i++)
{
cout<<ch;
ch--;
}
ch=zh-1;
cout<<endl;
for (j=0,i=n-2;j<n-1,i>=0;j++,i--)
{
for (k=0;k<i;k++)
cout<<sh;
cout<<ch;
for (l=j;l>0;l--)
cout<<sh;
cout<<ch;
for (l=j;l>0;l--)
cout<<sh;
cout<<ch;
for (k=0;k<i;k++)
cout<<sh;
ch--;
cout<<endl;
}
}