where can we use "try catch" and exception? : <p>How to throw a C++ exception
c++ exception-handling
I have a very poor understanding of exception handling(i.e., how to customize throw, try, catch statements for my own purposes).</p>

<p>For example, I have defined a function as follows: int compare(int a, int b){...}</p>

<p>I'd like the function to throw an exception with some message when either a or b is negative.</p>

<p>How should I approach this in the definition of the function?</p>
