![]() |
#2
xufen3402009-08-08 17:17
|
void pattern()
{
int i,j;
for(i=0;i<9;i++)
{
cout<<setw(2*(10-i))<<"";
for(j=0;j<2*i=1;j++)
cout<<"# ";
cout<<endl;
}
for(i=9;i>=0;i--)
cout<<setw(2*(10-i))<<"";
for(j=0;j<2*i+1;j++)
cout<<"# ";
cout<<endl;
}
这段代码是怎么判断字符输出在中央位置的,跟setw不是输出项宽度吗??
膜拜大牛,嘻嘻 估计还得是版主pangding嘻嘻 回答谢谢你了