title: How to throw a C++ exception
body: <p>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: <code>int compare(int a, int b){...}</code></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>