title: Coding hollow square in c++ with nested for loop and if statement
body: <p>So for a lab project the goal is to print out shapes using a "*."
  The four basic shapes are a square, two downwards pointing right triangles, and a hollow square. Everything seems to be working fine for any integer I input but I'm not entirely sure I'm doing the loop for the hollow square correctly and would like it if someone could give me some advice.</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using std::cout; using std::endl; using std::cin;
  
  int main()
  {
      cout &lt;&lt; "Input arbitrary integer ";
      int n;
      cin &gt;&gt; n;
      cout &lt;&lt; endl;
  
      for (int i = 0; i &lt; n; i++){
          for (int j = 0; j &lt; n; j++)
          {
              cout &lt;&lt; "*";
          }
          cout &lt;&lt; endl;
      }
      cout &lt;&lt; endl;
  
      for (int i = 1; i &lt;= n; i++){
          for (int j = n; j &gt;= i; j--)
          {
              cout &lt;&lt; "*";
          }
          cout &lt;&lt; endl;
      }
      cout &lt;&lt; endl;
  
      for (int i = 1; i &lt;= n; i++){
          for (int j = 2; j &lt;= i; j++)
          {
              cout &lt;&lt; " ";
          }
          for (int j = n; j &gt;= i; j--)
          {
              cout &lt;&lt; "*";
          }
          cout &lt;&lt; endl;
      }
      cout &lt;&lt; endl;
  
      for (int i = 1; i &lt;= n; i++){
          for (int j = 1; j &lt;= n; j++)
          {
              if (i == 1)
                  cout &lt;&lt; "*";
              else if (j == 1)
                  cout &lt;&lt; "*";
              else if (i == n)
                  cout &lt;&lt; "*";
              else if (j == n)
                  cout &lt;&lt; "*";
              else
                  cout &lt;&lt; " ";
          }
          cout &lt;&lt; endl;
      }
  
  }
  </code></pre>