View Code of Problem 125

#include <iostream>
using namespace std;

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

Double click to view unformatted code.


Back to problem 125