title: Possible operations error, random single digit output
body: <p>I have written this program for a class that asks for a positive number and based on the number, calculations are performed. I had some great help from stack folks last week but was asked by my professor to re-write it and simplify my code. I have done that and now the math is not coming out right. I have run the debugger but I dont see where the values being passed are incorrect. Also, all numbers are failing the "if (number > 0)" test. </p>
  
  <p>Could it be a compile error even though I get a successful build message?</p>
  
  <p>Thanks in advance!</p>
  
  <p>Here is the code.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;fstream&gt;  
  #include &lt;iomanip&gt;
  #include &lt;stdexcept&gt;
  #include &lt;cstdlib&gt;
  
  using namespace std;
  
  int main ()
  {
      system ("color F0");
  
      int number, countIf = 0, countWhile = 0, countDo = -1, h = 0, i = 0, x = 0, y = 0;
      char repeat = 'y';
  
      do {
  
          cout &lt;&lt; "Please enter a positive integer or zero to quit: ";
          cin &gt;&gt; number;
          x = number, y = number;
          cin.ignore();
  
          if (number &lt; 0) 
              cout &lt;&lt; "Error: The integer entered was either not positive or a zero.\n" &lt;&lt; endl;
  
          else if (number &gt; 0)
          {
              if (number%2 == 0 &amp;&amp; number%5 == 0)
                  for (y%5; countIf &lt;= y; countIf +=5)
                      {
                          i = y / 10;
                          i += countIf;
                          cout &lt;&lt; countIf &lt;&lt; " ";
                      }
  
              else if 
                  (countWhile &lt; x &amp;&amp; number%2 == 0) 
                      {
                          countWhile += 2;
                          cout &lt;&lt; countWhile &lt;&lt; " ";
                      }
  
              else 
                  {
                      countDo +=2;
                      cout &lt;&lt; countDo &lt;&lt; " ";
                  }
          } 
  
              cout &lt;&lt; "\n\nDo you wish to continue? (Y or N): ";
              cin &gt;&gt; repeat;
  }
          while (number != 0 &amp;&amp; repeat == 'y' || repeat == 'Y');
  
  
  
      //cout &lt;&lt; "\nThanks for playing!" &lt;&lt; endl;
      system ("pause");
      return 0;
  
  
  }
  </code></pre>
  
  <p>Output should be similar to: </p>
  
  <p><img src="https://i.stack.imgur.com/ZVjFA.png" alt="enter image description here"></p>
  
  <p>What I am getting is:</p>
  
  <p><img src="https://i.stack.imgur.com/c8F90.png" alt="enter image description here"></p>