打印小飞机

#include<iostream>

using namespace std;

int main()

{

int T,n,i,j,y;

cin>>T;

for(i=0;i<T;i++)

{

cin>>n;

for(j=0;j<(2*n-1);j++)

{

cout<<" ";

}cout<<"*\n";

for(j=(2*n-2);j>=n;j--)

{

for(y=0;y<j;y++)

{cout<<" ";}

cout<<"*";

for(y=0;y<(4*n-3-2*j);y++)

{cout<<" ";}

cout<<"*\n";

}

for(j=0;j<(n+1);j++)

{

cout<<"*";

}

for(j=0;j<(2*n-3);j++)

{

cout<<" ";

}

for(j=0;j<(n+1);j++)

{

cout<<"*";

}

cout<<'\n';

for(j=0;j<(n-2);j++)

{

cout<<"*";

for(y=0;y<(4*n-3);y++)

{

cout<<" ";

}

cout<<"*\n";

}

for(j=0;j<(n+1);j++)

{

cout<<"*";

}

for(j=0;j<(2*n-3);j++)

{

cout<<" ";

}

for(j=0;j<(n+1);j++)

{

cout<<"*";

}

cout<<'\n';

for(j=0;j<(n-1);j++)

{

for(y=0;y<n;y++)

{

cout<<" ";

}

cout<<"*";

for(y=0;y<(2*n-3);y++)

{

cout<<" ";

}

cout<<"*\n";

}

for(j=0;j<n;j++)

{

cout<<" ";

}

for(j=0;j<(2*n-1);j++)

{

cout<<"*";

}

cout<<'\n'<<'\n';

}

}

全部评论

相关推荐

Noob1024:一笔传三代,人走笔还在
点赞 评论 收藏
分享
1 收藏 评论
分享
牛客网
牛客企业服务