View Code of Problem 125

#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int h=3+2*n;
for(int i=0;i<h;i++)
{
	
		if(i==0||i==n+1||i==h-1)
		{
			cout<<" ";
			for(int j=0;j<n;j++)
			{
				cout<<"-";
			}
			cout<<" "<<endl;
		}
		else
		{
			cout<<"|";
			for(int j=0;j<n;j++)
			{
				cout<<" ";
			}
			cout<<"|"<<endl;
			
		}
 } 
	return 0;
 } 

Double click to view unformatted code.


Back to problem 125