title: Why is if statement not working
body: <p>I'm new to programming and can't work this out and have looked everywhere i can think for an answer. The if statement in <code>function1</code> <code>if (m != 0 || 1)</code> doesn't seem to be read when <code>cin &gt;&gt; 1</code> is passed from <code>function2</code>. Here is my code, any help would be appreciated.</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  void function1(int i);
  
  int main() {
      using namespace std;
  
      int i;
  
      function1(i);
  
  return 0;
  }
  ----------------------------------------------------------------------------
  #include &lt;iostream&gt;
  
  void function2();
  
  void function1(int i) {
      using namespace std;
      if (i != 0 || 1 ) /* not working when the variable 'i' is passed from function2 */ {     
      cout &lt;&lt; endl &lt;&lt; "i != 0 || 1" &lt;&lt; endl;
      function2();
      }
      else if (i == 0 || 1) {
          if (i == 0) {
              cout &lt;&lt; endl &lt;&lt; "m == 0" &lt;&lt; endl;
          }
          else if (i == 1) {
              cout &lt;&lt; endl &lt;&lt; "m == 1" &lt;&lt; endl;
          }
      }
  }
  ----------------------------------------------------------------------------
  #include &lt;iostream&gt;
  
  void function1(int i);
  
  void function2() {
      using namespace std;
  
      int i;
  
      cout &lt;&lt; endl &lt;&lt; "type 0 or 1" &lt;&lt; endl;
      cin &gt;&gt; i;    /* type 1 or 0 in here */
      function1(i);
  }
  </code></pre>