#include #include using namespace std; int main() { int nRowsBoxes{0}; int nColsBoxes{0}; int nRowsBlanks{0}; int nColsBlanks{0}; cout << "How many rows of boxes? "; cin >> nRowsBoxes; if(!cin) { cerr << "Could not input the number of rows.\n"; return EXIT_FAILURE; } cout << "How many columns of boxes? "; cin >> nColsBoxes; if(!cin) { cerr << "Could not input the number of columns.\n"; return EXIT_FAILURE; } cout << "How many rows of blanks in each box? "; cin >> nRowsBlanks; if(!cin) { cerr << "Could not input the number of blank rows.\n"; return EXIT_FAILURE; } cout << "How many columns of blanks in each box? "; cin >> nColsBlanks; if(!cin) { cerr << "Could not input the number of blank columns.\n"; return EXIT_FAILURE; } // Outer loop for each row of boxes for(int row{0}; row < nRowsBoxes; ++row) { // Top border of the box row for(int col{0}; col < nColsBoxes; ++col) { cout << "+"; for(int dash{0}; dash < nColsBlanks; ++dash) { cout << "-"; } } cout << "+\n"; // right edge // Interior blank rows for each box for(int blankRow{0}; blankRow < nRowsBlanks; ++blankRow) { for(int col{0}; col < nColsBoxes; ++col) { cout << "|"; for(int space{0}; space < nColsBlanks; ++space) { cout << " "; } } cout << "|\n"; // right edge } } // Bottom border (same as the top) for(int col{0}; col < nColsBoxes; ++col) { cout << "+"; for(int dash{0}; dash < nColsBlanks; ++dash) { cout << "-"; } } cout << "+\n"; return EXIT_SUCCESS; }