题目链接
https://www.nowcoder.com/pat/6/problem/4062
代码
#include<iostream>
#include<math.h>
using namespace std;
int main() {
int n;
char c;
cin >> n >> c;
int row = (n+1) / 2;
for(int i=0; i<row; i++) {
for(int j=0; j<n; j++) {
if(i == 0 || i == row-1 || j== 0 || j == n-1)
printf("%c", c);
else
printf(" ");
}
printf("\n");
}
}