Alterations with a integer in c++
<p>This is easy for you. I am busy with a test using c++. I have 2 values:</p>

<pre><code>0 and 1
</code></pre>

<p>I can find random number between. Now i want to alternate between them. If i get "1" in step one then in step two I want to get "0" and in step three "1" again where it alternate</p>

<pre><code>step1 = 1
step2 = 0
step3 = 1
step4 = 0
</code></pre>

<p>I tried increment and decrements</p>

<pre><code>  int value;
  if(value == 0)
  {   
      value = value + 1;
  }
  else if(value == 1)
  {
      value = value -1;
  }
</code></pre>

<p>This code does not work. If it sees a 0 it will become 1 but the next step the value will be 1 again.</p>
