title: Nesting if statements inside a While loop?
body: <p>I just started learning C++ a couple of weeks ago, so i'm far from an expert. I have a small project due in a couple of hours and I've came across a problem. I tried nesting two if statements inside a while loop, but it seems to be only running the first one and completely disregards the second one. Here's the code:</p>
  
  <pre><code>while (x &lt;= rows * columns) {
      cout &lt;&lt; "*";
      x++;
      if (x % intervals == 0) {
          cout &lt;&lt; "?";
          x++;
      }
      if (x % columns == 0) {
          cout &lt;&lt; "\n";
      }
  }
  cout &lt;&lt;"\nDONE!!!";
  </code></pre>
  
  <p>It doesn't run the second if statement, therefore I can't get any line breaks (rows).</p>