#include #include using namespace std; int main() { cout << "How many rows of boxes (e.g., 10)? "; int nrows_boxes {0}; cin >> nrows_boxes; if (!cin) { cerr << "Sorry, that wasn't a number.\n"; return EXIT_FAILURE; } cout << "How many columns of boxes (e.g., 10)? "; int ncols_boxes {0}; cin >> ncols_boxes; if (!cin) { cerr << "Sorry, that wasn't a number.\n"; return EXIT_FAILURE; } cout << "How many rows of blanks in each box (e.g., 1)? "; int nrows_blanks {0}; cin >> nrows_blanks; if (!cin) { cerr << "Sorry, that wasn't a number.\n"; return EXIT_FAILURE; } cout << "How many columns of blanks in each box (e.g., 3)? "; int ncols_blanks {0}; cin >> ncols_blanks; if (!cin) { cerr << "Sorry, that wasn't a number.\n"; return EXIT_FAILURE; } for (int r {0}; r < nrows_boxes; ++r) { for (int c {0}; c < ncols_boxes; ++c) { cout << "+"; for (int k {0}; k < ncols_blanks; ++k) { cout << "-"; } } cout << "+\n"; for (int i {0}; i < nrows_blanks; ++i) { for (int c {0}; c < ncols_boxes; ++c) { cout << "|"; for (int k {0}; k < ncols_blanks; ++k) { cout << " "; } } cout << "|\n"; } } for (int c {0}; c < ncols_boxes; ++c) { cout << "+"; for (int k {0}; k < ncols_blanks; ++k) { cout << "-"; } } cout << "+\n"; return EXIT_SUCCESS; }