title: C++ code does not work correctly?
body: <p>For the following code I have a problem. I want it to print out the print statement which matches the if statement, but instead, it prints ALL of the statements for each if statement. How do I rectify this? I'm a beginner you see, so sorry for the silly question..</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  int main()
  {
      int x;
      int y;
      int z;
  
      cout &lt;&lt; "Enter your first number" &lt;&lt; endl;
      cin &gt;&gt; x;
  
      cout &lt;&lt; "Enter your second number" &lt;&lt; endl;
      cin &gt;&gt; y;
  
      cout &lt;&lt; "Enter your third number" &lt;&lt; endl;
      cin &gt;&gt; z;
  
      ////////////Equilateral Triangle. All sides are the same/////////////
      if ((x == y) &amp;&amp; (y == z)) {
          cout &lt;&lt; "This is an Equilateral triangle" &lt;&lt; endl;
      }
  
      ////////////Isoceles Triangle. Two sides are the same/////////////
      if ((x == y) or (y == z) or (z == x)) {
          cout &lt;&lt; "This is an Isosceles triangle" &lt;&lt; endl;
      }
  
      ////////////Scalene Triangle. All sides are different/////////////
      if ((x &gt; y + z)or (y &gt; x + z) or (z &gt; x +y)) {
          cout &lt;&lt; "Opps! That didn't work! " &lt;&lt; endl;
      }
      else {
          cout &lt;&lt; "This is a scalene triangle" &lt;&lt; endl;
      }
  
      return 0; // exit program
  }
  </code></pre>