title: How to compare multiple variables with else if statement?
body: <p>I'm a beginner in C++. I've been given a homework from school to make some practices. One of them is to compare 3 variables typed by the user and make the program print on the screen which number is bigger or smaller. The problem is that every time I run the code, the program always prints the first typed number, even if it doesn't fulfill the condition.  Here is a sample of the code. I looked everywhere and I cannot understand what is wrong.</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  int var1 = 0;
  int var2 = 0;
  int var3 = 0;
  
  int main()
  {
      cout &lt;&lt; "Write 3 integer numbers" &lt;&lt; endl;
      cin &gt;&gt; num1 &gt;&gt; num2 &gt;&gt; num3;
  
      if (var1 &lt; var2,var3)
      {
          cout &lt;&lt; num1 &lt;&lt; " is smaller"&lt;&lt; endl;
      }
  
      else if (var2 &lt; var1,var3)
      {
          cout &lt;&lt; num2 &lt;&lt; " is smaller"&lt;&lt; endl;
      }
  
      else if (var3 &lt; var1,var2)
      {
          cout &lt;&lt; num3 &lt;&lt; " is smaller"&lt;&lt; endl;
      }
  
      system("pause");
  
  
  }
  </code></pre>