#include #include using namespace std; int main() { //Output graph paper. cout << "How many rows of boxes (e.g., 10)? "; int nrows {0}; cin >> nrows; if (!cin) { cerr << "Sorry, that wasn't a number.\n"; return EXIT_FAILURE; } cout << "How many columns of boxes (e.g., 10)? "; int ncols {0}; cin >> ncols; if (!cin) { cerr << "Sorry, that wasn't a number.\n"; return EXIT_FAILURE; } cout << "How many rows of blanks (e.g., 10)? "; int nrowsb {0}; cin >> nrowsb; if (!cin) { cerr << "Sorry, that wasn't a number.\n"; return EXIT_FAILURE; } cout << "How many columns of blanks (e.g., 10)? "; int ncolsb {0}; cin >> ncolsb; if (!cin) { cerr << "Sorry, that wasn't a number.\n"; return EXIT_FAILURE; } for (int r {0}; r < nrows; ++r) { for (int c {0}; c < ncols; ++c) { //Output a plus, followed by ncolsb dashes. cout << "+"; for (int cb {0}; cb < ncolsb; ++cb) { cout << "-"; } } cout << "\n"; for (int rb {0}; rb < nrowsb; ++rb) { for (int c {0}; c < ncols; ++c) { //Output vertical bar, followed by ncolsb blanks cout << "|"; for (int cb {0}; cb < ncolsb; ++cb) { cout << " "; } } cout << "\n"; } } return EXIT_SUCCESS; }