#include #include using namespace std; int main() { //Output graph paper. cout << "How many rows (e.g., 10)? "; int nrows; //uninitialized variable cin >> nrows; if (!cin) { cerr << "Sorry, that wasn't a number.\n"; return EXIT_FAILURE; } cout << "How many columns (e.g., 10)? "; int ncols; //uninitialized variable cin >> ncols; 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 nbrows; //uninitialized variable cin >> nbrows; 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 nbcols; //uninitialized variable cin >> nbcols; 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) { cout << "+"; for (int cb = 0; cb < nbcols; ++cb) { cout << "-"; } } cout << "\n"; for (int rb = 0; rb < nbrows; ++rb) { for (int c = 0; c < ncols; ++c) { cout << "|"; for (int cb = 0; cb < nbcols; ++cb) { cout << " "; } } cout << "\n"; } } return EXIT_SUCCESS; }