这道题并没有什么太大的难度,记住四舍五入的函数round()就OK。
头文件为#include<math.h>
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
double a,t;
string s;
cin >> a >> s;
t = round(a / 2);
for (int i = 0; i < t-1; i++)
{
for (int j = 0; j < a; j++) {
cout << s;
}
cout << endl;
}
for (int j = 0; j < a; j++) {
cout << s;
}
}