hdoj:2052

#include <iostream>
#include <string>

using namespace std;

int main()
{
    int n, m;
    while (cin >> m >> n)
    {
        for (int i = 0; i <= n+1; i++)
        {
            if (i == 0 || i == n+1)
            {
                cout << "+";
                for (int j = 1; j <= m; j++)
                    cout << "-";
                cout << "+";
                cout << endl;
            }
            else
            {
                cout << "|";
                for (int j = 1; j <= m; j++)
                    cout << " ";
                cout << "|";
                cout << endl;
            }

        }
        cout << endl;
    }
}
原文地址:https://www.cnblogs.com/bbbblog/p/6030965.html