每日一题,刷题第二天
这题也不难,下面是完整的代码
#include<iostream>
#include<math.h>
using namespace std;
int main() {
int n;
char a;
cin >> n >> a;
for (int i = 0; i < round(n/2.0); i++) {
if (i != 0 && i != round(n / 2.0) - 1) {
cout << a;
for (int j = 0; j < n - 2; j++) {
cout << " ";
}
cout << a << endl;
}
else {
for (int j = 0; j < n ; j++) {
cout << a;
}
cout << endl;
}
}
return 0;
}