View Code of Problem 125

#include<iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    for(int i = 1; i <= 2 * n +3; i++){
        if(i == 1 ||i == n + 2 ||i == 2 * n + 3){
            cout << " ";
            for(int j = 0; j < n; j++)
                cout << '-';
            cout << " "<<endl;
        }
        else{
            cout <<'|';
            for(int k = 0; k < n; k++)
                cout << " ";
            cout << '|' << endl;
        }
    }
}

Double click to view unformatted code.


Back to problem 125