title: If … change a variable’s value
body: <p>I’m trying to make a tic-tac-toe program; I'm adding an if statement to change a variable's value if the condition is met. But when the condition is met, the variable that's value should be changed is 0.</p>
  <p>I'm doing this in c++</p>
  <pre><code>cout &lt;&lt;player1 &lt;&lt; &quot;, which position would you like to add your X?: &quot; &lt;&lt; endl;
  
  cin &gt;&gt; x1;
  
  if (x1 == (b)) {
  xx1=5; 
  }
  </code></pre>
  <p>N.B. When it asks you which position would you like it add your X, I am typing &quot;a&quot;.</p>
  <p>I expected xx1's value to change to 5 but instead of 5 it was 0.</p>
  <p>Edit: I was using the &quot;=&quot; operator instead of the &quot;==&quot; operator. I ran the code and it worked, though now, a couple minutes later, it isn't working. I don't know what I did to make this happen, because the only thing that I did was setting it up for other letters.</p>