title: C++ Try Catch Block does not catch an exception
body: <p>I am a beginner in C++ and trying to create a simple console program that calculates the 'm' and 'b' of a linear equation... to parse the input double that the user provides, I am using a stringstream and using a try-catch block to check for false inputs.  A persistent error keeps following even though the catch block has a global exception [Unhandled exception at 0x74c8b9bc in Equation Solver.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000..]</p>
  
  <pre><code>double XOne;`enter code here`
  double YOne;
  double XTwo;
  double YTwo;
  bool inputCheck = false;
  while (inputCheck == false)
  {
      Clear();
      WriteLine("**Linear Equation**");
      Write("X1: ");
      string xone = ReadLine();
      Write("Y1: ");
      string yone = ReadLine();
      Write("X2: ");
      string xtwo = ReadLine();
      Write("Y2: ");
      string ytwo = ReadLine();
      try
      {
          stringstream s1(xone);
          if (s1 &gt;&gt; XOne) { s1 &gt;&gt; XOne; } else { throw; }
          stringstream s2(yone); // consider I give an invalid input for this variable
          if (s2 &gt;&gt; YOne) { s2 &gt;&gt; YOne; } else { throw; } // this doesn't solve the problem
          stringstream s3(xtwo);
          if (s3 &gt;&gt; XTwo) { s3 &gt;&gt; XTwo; } else { throw; }
          stringstream s4(ytwo);
          if (s4 &gt;&gt; YTwo) { s4 &gt;&gt; YTwo; } else { throw; }
      }
      catch (...) { WriteLine("Invalid Input"); ReadLine(); }
  }
  
  LinearEquation equation;
  equation.Initialize(XOne, YOne, XTwo, YTwo);
  stringstream s5;
  s5 &lt;&lt; equation.m;
  string m = s5.str();
  stringstream s6;
  s6 &lt;&lt; equation.b;
  string b = s6.str();
  Write("Y = ");
  Write(m);
  Write("X + ");
  WriteLine(b);
  ReadLine();
  </code></pre>
  
  <p><strong>EDIT</strong>
  The first suggestion worked like a charm... Thank you!
  This is the code after I modified it according to the reviewer.</p>
  
  <pre><code>double XOne;
  double YOne;
  double XTwo;
  double YTwo;
  bool inputCheck = false;
  while (inputCheck == false)
  {
      Clear();
      WriteLine("**Linear Equation**");
      Write("X1: ");
      string xone = ReadLine();
      Write("Y1: ");
      string yone = ReadLine();
      Write("X2: ");
      string xtwo = ReadLine();
      Write("Y2: ");
      string ytwo = ReadLine();
      try
      {
          stringstream s1(xone);
          if (s1 &gt;&gt; XOne) { s1 &gt;&gt; XOne; } else { throw runtime_error("Invalid Input"); }
          stringstream s2(yone);
          if (s2 &gt;&gt; YOne) { s2 &gt;&gt; YOne; } else { throw runtime_error("Invalid Input"); }
          stringstream s3(xtwo);
          if (s3 &gt;&gt; XTwo) { s3 &gt;&gt; XTwo; } else { throw runtime_error("Invalid Input"); }
          stringstream s4(ytwo);
          if (s4 &gt;&gt; YTwo) { s4 &gt;&gt; YTwo; } else { throw runtime_error("Invalid Input"); }
      }
      catch (runtime_error e) { WriteLine(e.what()); ReadLine(); }
  }
  
  LinearEquation equation;
  equation.Initialize(XOne, YOne, XTwo, YTwo);
  stringstream s5;
  s5 &lt;&lt; equation.m;
  string m = s5.str();
  stringstream s6;
  s6 &lt;&lt; equation.b;
  string b = s6.str();
  Write("Y = ");
  Write(m);
  Write("X + ");
  WriteLine(b);
  ReadLine();
  </code></pre>