View Code of Problem 125

#include <iostream>
using namespace std;
int main(){
    int n;
    while(cin>>n){
        for(int i=1;i<=3+2*n;i++){
            if(i==1||i==2+n*1||i==3+n*2){
                    cout<<" ";
                for(int j=1;j<=n;j++){
                    cout<<"-";
                }
                cout<<" ";
                cout<<endl;
            }
            if((i>1&&i<2+n*1)||(i>2+1*n&&i<3+n*2)){
                cout<<"|";
                for(int k=1;k<=n;k++){
                    cout<<" ";
                }
                cout<<"|";
                cout<<endl;
            }
        }
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 125