title: Build Two Half Pyramids in C++
body: <p>I'm in an introduction to C++ course, and my assignment is to build two half pyramids with height input by the user, with two spaces in between. They should look like <a href="http://i.stack.imgur.com/m6GtL.jpg" rel="nofollow">this</a>. The user can only input an integer between 1 and 23.</p>
  
  <p>EDIT: This is the answer my teacher wanted - she initially asked for us to use arrays to make these, but later changed her mind to do the project with for loops instead.</p>
  
  <pre><code>#include&lt;iostream&gt;
  using namespace std;
  
  int main(){
  int i,j,h;
  cout &lt;&lt; "Welcome to Mario. Please enter an integer between 1 and 23." &lt;&lt; endl;
  cin &gt;&gt; h;
  
  for(i=0;i&lt;h;i++)
      {
      for(j=h;j&gt;0;j--)
      {
          if (i+1 &gt;= j)
              cout &lt;&lt; "#";
          else
              cout &lt;&lt; " " ;
      }
      cout &lt;&lt; "  " ;
  
      for (j=0;j&lt;h;j++)
          {
          if (i&gt;=j)
          cout &lt;&lt; "#";
          }
      cout &lt;&lt; endl;
      }
  return 0;
  }
  </code></pre>
  
  <p><a href="http://i.stack.imgur.com/m6GtL.jpg" rel="nofollow">The generated two half pyramids</a></p>