title: bool doesn't want to change value c++
body: <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  int main()
  {
   int x - 0;
   bool even = true;
  
   while(cin &gt;&gt; x)
   {
     if(x%2 != 0)
     {
       even = false;
     }
   }
  
   if(even = true)
   {
     cout &lt;&lt; "all even";
   }
  
   else
   {
      cerr &lt;&lt; "not all even";
      return 1;
   }
  }
  </code></pre>
  
  <p>whenever i run this program, no matter the values I plug in (user ends input by pressing CTRL + D in the console) the value of even stays true, since the ending output is always "all even". </p>
  
  <p>I'm pretty sure the bool doesn't change because it is inside the while statement, but I do not know how to fix it since I need to leave it in there to check if each number I enter is odd.</p>
  
  <p>Any suggestions on how to fix this?</p>
  
  <p>Thanks!</p>