View Code of Problem 125

#include<iostream>

using namespace std;

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

Double click to view unformatted code.


Back to problem 125