#include <iostream.h>
void main()
{
int a,b,c;
char ch;
cout<<"How many lines?"<<endl;
cin>>a;
cout<<"What character?"<<endl;
cin>>ch;
for (b=a;b>=1;b--)
{
for(c=1;c<=2*a;c++)
{
if((1-b)<=(c-a)&&(c-a)<=(b-1))
cout<<ch;
else cout<<" ";
}
cout<<endl;
}
}
a是三角形的行数,输入ch值时输入A