title: C++ christmas tree
body: <p>I've just started learning C++ and decided to give myself a challenge by creating a simple Christmas Tree program. Everything has been working so far although the code doesn't produce what I expect. I've spent a decent amount of time trying to figure out what's wrong but can't seem to figure out why it doesn't work.</p>
  
  <p>So far, the code looks like this:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  
  int main(){
   char cTree;
   int iSize, iSpace;
  
   std::cout &lt;&lt; "Christmas Tree Application" &lt;&lt; std::endl;
   std::cout &lt;&lt; "Enter the size of your christmas tree: ";
   std::cin &gt;&gt; iSize;
   std::cout &lt;&lt; "Enter the character you would like to use for your tree: ";
   std::cin &gt;&gt; cTree;
  
   iSpace = iSize / 2;
  
   for(int i = 0; i &lt; iSize; i++){
      std::string sTree(i, cTree);
      //std::string sSpace(iSpace, ' ');
      std::cout &lt;&lt; sTree &lt;&lt; std::endl;
      //iSpace -= 1;
   }
  
   return 0;
  }
  </code></pre>
  
  <p>I've also commented out the 'spacing' part because whenever I execute it, it creates an error that I have no clue why it is says that. I know I can do the spacings in a different manner but I'd like to use the std::string way. Any help?</p>