#include<iostream> #include <math.h> #include <string> using namespace std; int isPrime(int n) { if (n <= 3) return n > 1; for (int i = 2; i <= sqrt(n); ++i) { if (n % i == 0) return 0; } return 1; } 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; return 0; } |
Double click to view unformatted code.