Reads an integer that is between lower and upper inclusive
| 31 | |
| 32 | // Reads an integer that is between lower and upper inclusive |
| 33 | int validate_input(int lower, int upper, const std::string& description) |
| 34 | { |
| 35 | int data {}; |
| 36 | std::cout << std::format("Please enter {} from {} to {}: ", description, lower, upper); |
| 37 | std::cin >> data; |
| 38 | while (data < lower || data > upper) |
| 39 | { |
| 40 | std::cout << "Invalid entry; please re-enter " << description << ": "; |
| 41 | std::cin >> data; |
| 42 | } |
| 43 | return data; |
| 44 | } |
| 45 | |
| 46 | // Reads the year |
| 47 | int year() |