in a given range. I'd like to modify it to use a predefined
default value if nothing, but as newline is entered. What
would be the best way to do that?
TIA
current code:
do {
cout << " Rows [" << MIN_ROWS << ".." << MAX_ROWS << "](" << DEF_ROWS <<
"): ";
cin >> rows;
cout << "Colums [" << MIN_COLS << ".." << MAX_COLS << "](" << DEF_COLS
<< "): ";
cin >> cols;
if ((rows < MIN_ROWS) || (rows > MAX_ROWS) || (cols < MIN_COLS) || (cols
MAX_COLS)) {
cout << "Values for rows and colums must be in the indicated range
\n";
cout << "Please re-enter, or ^C to abort: \n\n";
}
} while ((rows < MIN_ROWS) || (rows > MAX_ROWS) || (cols < MIN_COLS) ||
(cols > MAX_COLS));