给出的输入输出格式应该是
✨四舍五入的方法,是取余之后再*10/2 判断是否大于五
✨利用双重for循环 来控制空格和字符的输出
using namespace std;
int main(){
int n;
char c;
cin>>n>>c;
int row = 0;
if((n%2)*10 /2 >= 5){
row = n/2 +1;
}else{
row = n/2;
}
for(int i=0;i<row;i++){
for(int j=0;j<n;j++){
if(i==0||i==row-1){
cout<<c;
}else{
if(j==0||j==n-1){
cout<<c;
}else{
cout<<" ";
}
}
}
cout<<endl;
}
}