title: Solving a system of 2 Linear Equations using c++
body: <p>Hello I'm having trouble writing a solution code for my homework. I am required to ask the user to input 6 variable for two equations. After successfully pulling numbers only, I need to find the slope of each line, the y-intercept for each line, two points on each line(ordered pair such as (2,1)), if there is a solution. Also what the relationship is. I have searched and searched for mostly number checking and equations. What I am having trouble with is finding the points and solutions to the equations.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;limits&gt;
  
  int main()
  {
  std::cout&lt;&lt;"This program is designed to test two linear equations. \n";
  std::cout&lt;&lt;"In order to best solve the system, \n";
  std::cout&lt;&lt;"equations will be in the form of a*x + b*y = c. \n";
  std::cout&lt;&lt;"and d*x + e*y =f. \n";
  std::cout&lt;&lt;"Please enter an integer for a, b, and c. \n";
  double a, b, c, d, e, f;
  
  while ((std::cout &lt;&lt; "Enter a.") 
       &amp;&amp; !(std::cin &gt;&gt; a))
  {
      std::cout &lt;&lt; "That's not a number ";
      std::cin.clear();
      std::cin.ignore(std::numeric_limits&lt;std::streamsize&gt;::max(), '\n');
  }
  while ((std::cout &lt;&lt; "Enter b.")
            &amp;&amp; !(std::cin &gt;&gt; b))
  {
      std::cout &lt;&lt; "That's not a number ";
      std::cin.clear();
      std::cin.ignore(std::numeric_limits&lt;std::streamsize&gt;::max(), '\n');
  }
  while ((std::cout &lt;&lt; "Enter c.")
            &amp;&amp; !(std::cin &gt;&gt; c))
  {
      std::cout &lt;&lt; "That's not a number ";
      std::cin.clear();
      std::cin.ignore(std::numeric_limits&lt;std::streamsize&gt;::max(), '\n');
  }
  std::cout&lt;&lt;"Equation 1 is "&lt;&lt;a&lt;&lt;"x +"&lt;&lt;b&lt;&lt;"y ="&lt;&lt;c;
  
  std::cout&lt;&lt;"Please enter an integer for d, e, and f. \n";
  
  while ((std::cout &lt;&lt; "Enter d.")
           &amp;&amp; !(std::cin &gt;&gt; d))
  {
      std::cout &lt;&lt; "That's not a number ";
      std::cin.clear();
      std::cin.ignore(std::numeric_limits&lt;std::streamsize&gt;::max(), '\n');
  }
  while ((std::cout &lt;&lt; "Enter e.")
            &amp;&amp; !(std::cin &gt;&gt; e))
  {
      std::cout &lt;&lt; "That's not a number ";
      std::cin.clear();
      std::cin.ignore(std::numeric_limits&lt;std::streamsize&gt;::max(), '\n');
  }
  while ((std::cout &lt;&lt; "Enter f.")
            &amp;&amp; !(std::cin &gt;&gt; f))
  {
      std::cout &lt;&lt; "That's not a number ";
      std::cin.clear();
      std::cin.ignore(std::numeric_limits&lt;std::streamsize&gt;::max(), '\n');
      }
      std::cout&lt;&lt;"Equation 2 is "&lt;&lt;d&lt;&lt;"x +"&lt;&lt;e&lt;&lt;"y ="&lt;&lt;f;
  
      double slope1, slope2;
      double x1, x2, y1, y2;
      slope1 = (b / a);
      slope2 = (e / d);
      std::cout&lt;&lt;" Slope of Equation 1 is "&lt;&lt;slope1&lt;&lt;"\n";
      std::cout&lt;&lt;" Slope of Equation 2 is "&lt;&lt;slope2&lt;&lt;"\n";
  
      x1 = ((c*e)-(b*f))/ ((a*e)-(b*d));
      y1 = ((a*f)-(c*d))/ ((a*e)-(b*d));
  
      return 0;
  }
  </code></pre>