|
|
|
@ -3,27 +3,27 @@ void diamond(int a)
|
|
|
|
|
{
|
|
|
|
|
int b,c,d,t;
|
|
|
|
|
d=0;
|
|
|
|
|
t=a;//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݸ<EFBFBD>t
|
|
|
|
|
while(a--)//<EFBFBD>ո<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>
|
|
|
|
|
t=a;//将初始数数据给t
|
|
|
|
|
while(a--)//空格数逐层递减
|
|
|
|
|
{
|
|
|
|
|
for(b=0; b<a; b++)
|
|
|
|
|
{
|
|
|
|
|
printf(" ");
|
|
|
|
|
}
|
|
|
|
|
printf("*");
|
|
|
|
|
for(c=1; c<d; c++)//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD>ո<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
for(c=1; c<d; c++)//菱形内部空格数
|
|
|
|
|
{
|
|
|
|
|
printf("*");
|
|
|
|
|
}
|
|
|
|
|
if(d!=0)printf("*");
|
|
|
|
|
printf("\n");//һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
printf("\n");//一行输出结束
|
|
|
|
|
d=d+2;
|
|
|
|
|
}//<EFBFBD><EFBFBD><EFBFBD>ε<EFBFBD><EFBFBD>ϰ벿<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
}//菱形的上半部分输出结束
|
|
|
|
|
a=t;
|
|
|
|
|
d=d-2;
|
|
|
|
|
a= a- 1;
|
|
|
|
|
d=0;
|
|
|
|
|
while(a--)//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ε<EFBFBD><EFBFBD>°벿<EFBFBD><EFBFBD>
|
|
|
|
|
while(a--)//输出菱形的下半部分
|
|
|
|
|
{
|
|
|
|
|
for(c=1; c<(t-a); c++)
|
|
|
|
|
{
|
|
|
|
|