一个难解的矩阵问题~~求解

昨晚在一QQ群里,碰到有网友问这样一个问题,如何在控制台上输出如下图形:

他个人给出的程序是:

using System;
using System.Collections;

namespace liuyue

 public class Hello
 {
  public static void Main()
  {
   
    int x = 10;
   
   for(int i = 0;i<x;i++)
   {
    for(int j=0;j<10;j++) 
    {
     if(j<1 || i<1 || j==9 || i==9 || (i==2 && (j>1 && j<8))||(j==2 && (i>1 && i<8)) ||(i==7 && (j>2&&j<8))||(j==7 && (i>2&&i<8))||((i==4||i==5)&&(j==5||j==4)))
     {
      Console.Write("{0,2}","+");
     }
     else
     {
       Console.Write("{0,2}","-");
     }
    }
    Console.WriteLine();
   }
  }
 }
}

..

  求教园子里达人们,看看如何才能高效的输出这个图形,能够达到不用指定上限最好.

  我个人希望看到C++版的实现---因为最近在学习C++

  

<h3>
   心静似高山流水不动,心清若巫峰雾气不沾。
</h3>
原文地址:https://www.cnblogs.com/McJeremy/p/1518766.html