title: If Statement logic is not correct
body: <p>I have this <code>if</code> statement and it is not working:</p>
  
  <pre><code>if (pEntry-&gt;GetStudentMaterialStudyPoint(StudentAssign::kBibleReading) == 1 &amp;&amp;
      (pEntry-&gt;GetStudentMaterialStudyPoint(StudentAssign::kItem1) == 1 &amp;&amp; LOBYTE(LOWORD(pEntry-&gt;GetStudentAssignFlags()))) &amp;&amp;
      (pEntry-&gt;GetStudentMaterialStudyPoint(StudentAssign::kItem2) == 1 &amp;&amp; HIBYTE(LOWORD(pEntry-&gt;GetStudentAssignFlags()))) &amp;&amp;
      (pEntry-&gt;GetStudentMaterialStudyPoint(StudentAssign::kItem3) == 1 &amp;&amp; LOBYTE(HIWORD(pEntry-&gt;GetStudentAssignFlags()))) &amp;&amp;
      (pEntry-&gt;GetStudentMaterialStudyPoint(StudentAssign::kItem4) == 1 &amp;&amp; HIBYTE(HIWORD(pEntry-&gt;GetStudentAssignFlags()))))
  {
      MWBValidationErrorStruct errorMWBValidation;
  
      errorMWBValidation.iDateIndex = iDateIndex;
      errorMWBValidation.datMeeting = pEntry-&gt;GetMeetingDate();
      errorMWBValidation.eValidationErrorType = CChristianLifeMinistryDefines::MWBValidationErrorType::MaterialStudyPoints;
  
      m_listValidationErrors.push_back(errorMWBValidation);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I am trying to find out if all of the items have a value of 1. The first item (bible reading) will always be checked. But the items 1 to 4 only need to be checked if they are "included". That is what the <code>LOBYTE(LOWORD(pEntry-&gt;GetStudentAssignFlags()))</code> is for.</p>
  
  <p>So,</p>
  
  <pre><code>Bible Reading - 1
  Item 1 - 1
  Item 2 - 1 - Not included
  Item 3 - 1 - Not included
  Item 4 - 1 - Not included
  </code></pre>
  
  <p>In the above scenario the <code>if</code> should be <code>true</code> because both BR and Item 1 are set to 1. We ignore the other 3 items.</p>
  
  <pre><code>Bible Reading - 1
  Item 1 - 2
  Item 2 - 3
  Item 3 - 1 - Not included
  Item 4 - 1 - Not included
  </code></pre>
  
  <p>In the above scenario the <code>if</code> should return <code>false</code> because all the values are not 1 and we are ignoring the last two items.</p>
  
  <p>What is wrong with my <code>if</code> logic?</p>