fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int j,i,n;
  7. cin>>n;
  8. for(i=1;i<=n;i++){
  9. for(j=1;j<=n;j++){
  10. if(i==j||j==i||j+i==n+1) cout<<"+";
  11. else cout<<"-";
  12. }
  13. cout<<"\n";
  14. }
  15. return 0;
  16. }
Success #stdin #stdout 0.01s 5316KB
stdin
5
stdout
+---+
-+-+-
--+--
-+-+-
+---+