天梯赛训练 7-7 跟奥巴马一起画方块

水题  四舍五入+0.5

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    char s;
    cin >> n >> s;
    m=(int)(n*0.5+0.5);
    for(int i=1;i<=m;i++)
    {
        for(int j=1;j<=n;j++)
        {
            cout << s;
        }
        cout << endl;
    }
    return 0;
}

原文地址:https://www.cnblogs.com/qq-1585047819/p/10482771.html