CJCoding With Joseph
15free / daySign inCreate account

Report Overdue Days or the Problem

The function daysOverdue(int dueDay, int returnDay) is already written: it returns how many days late a library book is, and throws a std::logic_error when the book came back before its due date. Write report(int dueDay, int returnDay), which calls it inside a try block and prints Overdue days: followed by the number. If an exception is thrown, catch it by const std::exception& (the base class of every standard exception) and print Problem: followed by the text that what() returns.

The tests read the two day numbers from the input and call report once. For the input 10 14 the output is shown in Expected Output.

Do NOT write a main function.

Expected Output:

Overdue days: 4

= newline. The output ends with a newline — print one after the last line.

Hints4 available
Topics:
Exceptions
📥 Auto-Input:
10 14\n
This input is automatically fed to your program's stdin
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.