View Code of Problem 125

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

Double click to view unformatted code.


Back to problem 125