Here, logic_error is a standard
exception class that is declared in the <stdexcept>
header.
The keyword throw indicates that the function
exits immediately, but the function does not return to the caller. Instead,
the program searches for a handler that specifies how to handle the
logic error.
You supply an exception handler with the
try statement.