1256.cpp
来自「杭电 acm部分代码 有兴趣的可以下载 谢谢」· C++ 代码 · 共 46 行
CPP
46 行
#include <iostream>
using namespace std;
const int MAX=100;
int main()
{
int n,ca,high,cb,bold,temp,uplen,downlen,now;
char fill,line[MAX]={0},line2[MAX]={0};
cin>>n;
for(ca=0;ca<n;ca++){
cin>>fill>>high;
bold=1;
temp=high;
while(temp>=6){
bold++;
temp-=6;
}
uplen=(high-3)/2;
downlen=high-3-uplen;
now=0;
for(cb=0;cb<bold;cb++,now++)
line[now]=' ';
for(cb=0;cb<downlen;cb++,now++)
line[now]=fill;
line[now]='\0';
now=0;
for(cb=0;cb<bold;cb++,now++)
line2[now]=fill;
for(cb=0;cb<downlen;cb++,now++)
line2[now]=' ';
for(cb=0;cb<bold;cb++,now++)
line2[now]=fill;
line2[now]='\0';
cout<<line<<endl;
for(cb=0;cb<uplen;cb++)
cout<<line2<<endl;
cout<<line<<endl;
for(cb=0;cb<downlen;cb++)
cout<<line2<<endl;
cout<<line<<endl;
if(ca!=n-1)
cout<<endl;
}
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?