题目1065:输出梯形
AC:
#include<iostream>
using namespace std;
int main()
{
int h;
while(cin>>h)
{
int i,j,k,t;
k=(h-1)*2;
t=h;
for (i=0;i<h;i++)//////////////h在此处已用,所以用t=h来代替重用;
{
for (j=0;j<k;j++)
cout<<" ";
k-=2;
for (j=0;j<t;j++)
cout<<"*";
t+=2;
cout<<endl;
}
}
return 0;
}