g | x | w | all
Bytes Lang Time Link
021Dyalog APL250903T160538ZAaron
055R250903T133123ZGiuseppe
036Regenerate210703T214525ZDLosc
090sed 4.2.2240414T174225Zguest430
094><> Fish221105T104552Zmousetai
00505AB1E170814T172913ZErik the
038Regenerate a210703T222136ZDLosc
036Vim210430T032349ZDLosc
012Vyxal C210604T013458Zemanresu
007Canvas210429T112133ZRazetime
097Batch210429T205635ZT3RR0R
025APL NARS2000200908T175441Zjimfan
012Japt R200908T150009ZShaggy
047PowerShell191218T202809Zmazzy
625Shakespeare Programming Language170414T134448ZMaya
027GolfScript191217T132534ZPseudo N
067Wren191217T065859Zuser8505
037Keg191216T234629Zlyxal
023CJam170411T160432ZMartin E
017J191216T185638ZAdá
059JavaScript ES6170411T155029ZShaggy
086Excel170818T142021ZWernisch
nanPerl 5170815T034405ZXcali
024Pyth170814T172106Zchromati
089Rust170527T132227Zbearbear
069Common Lisp170513T104443Zuser6516
0578086 machine code170421T042622Zuser5434
024Japt170420T173612ZOliver
nanBrainFlak170419T042130Z0
056Python 2170411T160455ZKeerthan
021J170413T230845Zephemien
048MUMPS170411T213448Zmumpsimu
005Charcoal170411T172423Zfergusq
054R170412T130418Zcount
014Pyke170412T172402ZBlue
099GNU sed170411T165832ZRiley
068PHP170411T165210ZJör
081REXX170412T113559Zidrougge
015V170411T152827Zuser4180
01205AB1E170411T171505ZMagic Oc
048PowerShell170412T063120ZJoey
031Octave170412T044531Zrahnema1
052Python 2170411T203146Zxnor
017CJam170411T203458Zaditsu q
108Batch170411T194435ZNeil
060JavaScript ES6170411T194106ZNeil
4140Ruby170411T175428ZVentero
090Lua170411T175849ZBlab
069C170411T164710ZQuentin
053Python 2170411T164111ZDennis
045Perl 5170411T161254ZDada
073JS ES6170411T154225Zuser5882
013Charcoal170411T154013Zuser4180
011Jelly170411T154726ZDennis
011MATL170411T151755ZLuis Men
025Charcoal170411T152221ZSteadybo
039Mathematica170411T153553ZMartin E
065Python 2170411T153500Zmath jun
048PowerShell170411T152723ZAdmBorkB

Dyalog APL, 21 bytes

{' +'[1+⍵∊¨⍳,⍨⍵+⍵-1]}­⁡​‎‎⁡⁠⁢‏⁠‎⁡⁠⁣‏⁠‎⁡⁠⁤‏⁠‎⁡⁠⁢⁡‏⁠‎⁡⁠⁢⁢‏⁠‎⁡⁠⁢⁡⁤‏‏​⁡⁠⁡‌⁢​‎‎⁡⁠⁤⁣‏⁠‎⁡⁠⁤⁤‏⁠‎⁡⁠⁢⁡⁡‏⁠‎⁡⁠⁢⁡⁢‏⁠‎⁡⁠⁢⁡⁣‏‏​⁡⁠⁡‌⁣​‎‎⁡⁠⁤⁡‏⁠‎⁡⁠⁤⁢‏‏​⁡⁠⁡‌⁤​‎‎⁡⁠⁣⁤‏‏​⁡⁠⁡‌⁢⁡​‎‎⁡⁠⁣⁡‏⁠‎⁡⁠⁣⁢‏⁠‎⁡⁠⁣⁣‏‏​⁡⁠⁡‌⁢⁢​‎‎⁡⁠⁢⁣‏⁠‎⁡⁠⁢⁤‏‏​⁡⁠⁡‌­
 ' +'[             ]   # ‎⁡Index into this string
              ⍵+⍵-1    # ‎⁢2x-1 the input
            ,⍨         # ‎⁣Make a duplicate of that number
           ⍳           # ‎⁤Generate indices for that.  This makes a matrix of coordinates from [1..x,1..x]
        ⍵∊¨            # ‎⁢⁡Find where the input number is an element of those coordinate pairs.  That will be the middle row and middle column
      1+               # ‎⁢⁢Add 1 for indexing's sake
💎

Created with the help of Luminespire.

R, 55 bytes

\(n,y=2*n-1,z=1:y-n)write(c(" ","+")[1+!z%o%z],1,y,,"")

Attempt This Online!

The older R answer doesn't print the output; even if using the newer \ syntax for function, it would be longer than this, something like this

Regenerate, 38 36 bytes

(( {$~1-1}\+
){$~1-1})\+{$~1*2-1}
$1

Attempt This Online!

Explanation

Space is represented by underscore and newline by ¶ for better visibility.

(( {$~1-1}\+¶){$~1-1})\+{$~1*2-1}¶$1
(                    )                Group 1: the section above the center line
 (           )                         Group 2: one line of that section
  _{$~1-1}                              n-1 spaces
          \+¶                           followed by + and newline
              {$~1-1}                  Repeat n-1 times
                      \+{$~1*2-1}     n*2-1 + characters
                                 ¶    followed by newline
                                  $1  Contents of group 1 again

sed 4.2.2, 90 bytes

s/ //
h
H
s/.*/&+&/
tb
:a
p
:b
x
s/\n /\n/
x
ta
y/ /+/
p
x
h
s/\n/+/
t
:c
p
:
x
s/ //
x
tc

Try it online!

almost a quarter of the bytes are just correcting off-by-one errors, but at least it beat the other answer. this problem would be a lot easier if 2, or better yet, 3, was the first required bit.

while their answer builds the solution up inside the pattern space, this one just prints it out line by line while decrementing a unary counter. takes input as unary spaces. accepting decimal gets me 114 bytes.

explanation:

s/ //;h;H                    # delete 1 space, stick in hold space twice
s/.*/&+&/                    # & is the full match, so it becomes 'MATCH+MATCH'
tb;:a;p;:b;x;s/\n /\n/;x;ta  # loop that first decrements the second hold space and then prints that line
y/ /+/;p                     # swap spaces to +s and prints 
x;h;s/\n/+/                  # bring in that second hold space and pattern becomes 'MATCH+'
t;:c;p;:;x;s/ //;x;tc        # loop that first decrements the hold space and then prints that line

><> (Fish), 94 bytes

1-:?!/:::?v"+"o~ \
 84*o1-70.\
>.!07$&:&v!?:-1oa/
/+1 *2:~ /
 /ao~";"93p10.
<\!?:-1o"+"
 ;"+"\

Try it online! Animated Version

Explanation

enter image description here

The yellow loop special cases the 1 cross variant to print a + and exit.

The blue loop is the loops over each line. The green loop prints N spaces and the blue loop then prints a "+" at the end of each line.

The orange bypass calculates the length of the row which will have only + signs (2n + 1). Then it will enter the blue-purple loop.

The blue-purple loop prints the plus signs in the middle row. Once the count reaches 0 the mirror isn't skipped anymore so the pink segment is entered.

The pink segment replaces the mirror at 9,3 with a ;. This is the red highlighted semicolon in the picture. Then jumps back to the blue loop. However, this time instead of printing the row of + signs it will exit. (; means exit program in fish)

05AB1E, 5 bytes

'+90Λ

Try it online!

Regenerate -a, 38 bytes

(({2,$~1} |\+|{2,$~1} )$2{$~1-2}!)\+$1

Takes input as a command-line argument. Try it here!

Explanation

Here, we're going to (ab)use Regenerate's backtracking algorithm. The regex describes several possibilities for a single line, and the -a flag instructs Regenerate to output all possible matches. I'm going to start with a slightly different version that doesn't work for input \$n=1\$, and then discuss how to deal with that corner case afterwards.

Space is represented by underscore for better visibility.

(({2,$~1} |\+|{2,$~1} )$2{$~1-2})\+$1
(                               )      Group 1: the part before the central + character:
                                       either n-1 spaces or n-1 + characters
 (                    )                 Group 2: which character to use
                                         Option 1:
  {2,$~1}                                 Repeat empty string between 2 and n times
                                          (this causes the backtracker to try n-1 different
                                          options, all of them equal to empty string)
         _                                followed by space
          |                              Option 2:
           \+                             + character
             |                           Option 3:
              {2,$~1}_                    Same deal as option 1
                       $2               Group 2 again...
                         {$~1-2}        ... repeated n-2 times, for a total of n-1
                                 \+    The central + character
                                   $1  followed by group 1 again

When backtracking over group 2, Regenerate will try space \$n-1\$ times, then +, then space another \$n-1\$ times. So the list of all possible matches will be \$n-1\$ lines of spaces with a + in the middle, one line of + characters with a + in the middle, and \$n-1\$ more lines of spaces with a + in the middle--exactly the output we want.

There is a problem with \$n=1\$, however. We want group 1 to match the empty string, so that the only possible match for the full regex is +. However, with input of \$1\$, group 1 fails to match. The culprit is $2{$~1-2}, "repeat group 2's contents \$n-2\$ times." It's not possible to repeat something \$-1\$ times, so the whole group fails.

We can get around this failure by providing empty string as another alternative inside group 1. However, using | here raises another issue: we don't want the empty string to be tried if the first alternative succeeded, only if it failed. (Since we're asking for all possible matches, we would get a stray + at the end of the output for \$n>1\$.)

The solution is to use !, a greedy version of |. If its left side matches at all, it takes the left side's match(es) and never tries the right side. It only tries the right side if its left side fails entirely. Thus, our final solution is:

((...)$2{$~1-2}!)\+$1
(               )      Group 1: the part before the central + character
 (...)                  Group 2: same options as before
      $2{$~1-2}         Repeat group 2 again n-2 times
               !        Or, iff that fails because n-2 < 0...
                        Empty string
                 \+    The central + character
                   $1  followed by group 1 again

Vim, 36 bytes

<C-x>D@-i <esc>Y@-pVGy:1s/ /+/g
P:%s/.*/&+&

The byte-count includes a trailing newline. Try it online!

Explanation

<C-x>D

Decrement the input number n and delete it. The deleted text is stored in the "small deletion" register "-.

@-i <esc>

Insert a space "- times.

Y@-p

Yank that line, and then paste it "- times. We now have n lines of n-1 spaces each, with the cursor at the beginning of line 2.

VGy

Select all lines till the end of the file (i.e. n-1 lines, all but the first one) and yank them.

:1s/ /+/g

On line 1, replace each space with a plus sign. This command leaves the cursor on line 1.

P

Paste the previously yanked lines above the current line. We now have n-1 lines of spaces, one line of plus signs, and n-1 more lines of spaces.

:%s/.*/&+&

Replace each line with itself followed by a plus sign followed by itself again.

Vyxal C, 12 bytes

\+*÷:?d›*Wøm

Try it Online!

-2 thanks to @astonearachnid. -1 thanks to lyxal.

Canvas, 8 7 bytes

+×:⤢n!┼

Try it here!

-1 byte from hakr14.

Batch 97 bytes

requires windows 10 with virtual terminal support

Set x=%~1&cls&@Set/a c=x*2-1
@For /L %%i in (1 1 %c%)Do @Echo(ESC[%%i;%x%H+ESC[%x%;%%iH+ESC[%x%BESC[1G

ESC is the ANSI escape character, which doesn't paste well but can be copied from the raw paste data here.
Or it can be generated by opening the command prompt and typing >"%TEMP%\escape.chr" Echo(ALT+027 then pressing ENTER, or output using a for loop with Echo off:

(For /F "skip=4 DELIMS=" %a in ('Echo(prompt $E^|cmd')Do Echo(%a) >"%TEMP%\escape.chr"

How:
Iterates over the width of the string c and outputs c+ along the the x (y and x) intersection using virtual terminal sequences to move the cursor to the relevant coordinates.

APL (NARS2000), 25 characters:

{' +'[1+∨/¨⍵=∘.,⍨⍳⍵+⍵-1]}

APL (NARS2000), 26 characters:

{' +'[1+∨/¨⍵=∘.,⍨⍳¯1+2×⍵]}

Examples:

      {' +'[1+∨/¨⍵=∘.,⍨⍳⍵+⍵-1]} 1
+
      {' +'[1+∨/¨⍵=∘.,⍨⍳⍵+⍵-1]} 2
 + 
+++
 + 
      {' +'[1+∨/¨⍵=∘.,⍨⍳⍵+⍵-1]} 3
  +  
  +  
+++++
  +  
  +  
      {' +'[1+∨/¨⍵=∘.,⍨⍳⍵+⍵-1]} 4
   +   
   +   
   +   
+++++++
   +   
   +   
   +  

Rationale:

Take n = 4 as example. Objective is to generate an integer matrix as below:

1 1 1 2 1 1 1
1 1 1 2 1 1 1
1 1 1 2 1 1 1
2 2 2 2 2 2 2
1 1 1 2 1 1 1
1 1 1 2 1 1 1
1 1 1 2 1 1 1

Expression ⍵=∘.,⍨⍳⍵+⍵-1, when given ⍵ = 4, generates matrix of 2-tuple from integer vector 1..7:

 0 0  0 0  0 0  0 1  0 0  0 0  0 0 
 0 0  0 0  0 0  0 1  0 0  0 0  0 0 
 0 0  0 0  0 0  0 1  0 0  0 0  0 0 
 1 0  1 0  1 0  1 1  1 0  1 0  1 0 
 0 0  0 0  0 0  0 1  0 0  0 0  0 0 
 0 0  0 0  0 0  0 1  0 0  0 0  0 0 
 0 0  0 0  0 0  0 1  0 0  0 0  0 0 

Each cell is reduced by logical-or ∨/¨ to give boolean matrix:

0 0 0 1 0 0 0
0 0 0 1 0 0 0
0 0 0 1 0 0 0
1 1 1 1 1 1 1
0 0 0 1 0 0 0
0 0 0 1 0 0 0
0 0 0 1 0 0 0

Add 1 to this matrix and we have the desired array-indexing matrix.

Japt -R, 12 bytes

Look, Ma, no +!

çÄ ê
¬hNÉU û

Try it

PowerShell, 47 bytes

param($n)($x=,(' '*--$n+'+')*$n)
'+'+'++'*$n
$x

Try it online!

This one is shorter than 48 bytes ¯\_(ツ)_/¯

Shakespeare Programming Language, 749 743 666 625 bytes

N.Puck,.Page,.Ford,.Ajax,.Act I:.Scene I:.[Enter Puck and Ford]Puck:Listen tothy!Ford:You is the difference betweena cat I.Scene V:.[Exeunt][Enter Page and Ajax]Ajax:You is the difference betweena cat Ford.Scene X:.Page:You is the product ofPuck I.Is you as big as zero?If soyou is the sum oftwice the sum oftwice twice the sum ofa big big cat a cat a cat a cat.If notyou big big big big big cat.Speak thy!Ajax:You is the sum ofyou a cat.Is you worse Ford?If soLet usScene X.Page:You is twice the sum ofa big big cat a cat.Speak thy![Exit Page][Enter Puck]Ajax:You is the sum ofyou a cat.Is you worse Ford?If soLet usScene V.

Try it online!

With added newlines:

N.
Puck,.
Page,.
Ford,.
Ajax,.
Act I:.
Scene I:.
[Enter Puck and Ford]
Puck:Listen tothy!
Ford:You is the difference betweena cat I.
Scene V:.
[Exeunt]
[Enter Page and Ajax]
Ajax:You is the difference betweena cat Ford.
Scene X:.
Page:You is the product ofPuck I.Is you as big as zero?
If soYou is the sum ofTwice the sum ofTwice twice the sum ofA big big cat a cat a cat a cat.
If notyou big big big big big cat.Speak thy!
Ajax:You is the sum ofyou a cat.Is you worse Ford?If soLet usScene X.
Page:You is twice the sum ofa big big cat a cat.Speak thy!
[Exit Page]
[Enter Puck]
Ajax:You is the sum ofyou a cat.Is you worse Ford?If soLet usScene V.

Golfed 6 bytes because scene numbers don't have to be consecutive. Golfed some more bytes by applying the tips in the new answers to the Shakespeare tips question, though these golfs aren't reflected in the explanation.

(Slightly outdated) explaination

SPL is an esolang designed to look like Shakespeare plays. Positive nouns have the value of 1 (here cat is used) and negative nouns have the value of -1 (none were used but pig is one of them). Adjectives modify a constant by multiplying it by 2.

N.

Everything until the first dot is the title and doesn't matter.

Puck,.                           row counter
Page,.                           column counter
Ford,.                           input
Ajax,.                           temp

The characters are integer variables, each of them also has a stack but I did not need to use that feature.

Act I:.
Scene I:.

Acts and scenes are used as goto labels

[Enter Puck and Ford]

It's only useful if exactly two characters are on the stage at the same time.

Puck:Listen to thy heart!

Reads a number and makes Ford remember it.

Ford:You is the difference between a cat and I.

As you can see Engrish is valid in SPL. This makes Puck's value "the different between a cat and I". But what does it mean? cat is a positive noun, so it's Puck = 1 - Ford.

Scene II:.
[Exeunt]

Exeunt is just a plural of "exit", and without arguments means that everyone on the stage exits.

[Enter Page and Ajax]
Ajax:You is the difference between a cat and Ford.

It's also Page = 1 - Ford but it's spoken by a different actor so I would be wrong. Since it's a loop, I can't just copy the value of Puck.

Scene III:.
Page:You is the product of Puck and I.

Pretty straightforward by now. Ajax = Puck * Page.

Is you as big as zero?

"as [adj] as" is the == operator.

If so,you is the sum of the sum of the sum of a big big big big big cat and a big big big cat and a big cat and a cat.

If Ajax == 0... "cat" is 1, "big cat" is 2, "big big cat" is 4 and so on. After substituting the simple constants we get "the sum of the sum of the sum of 32 and 8 and 2 and 1" -> "the sum of the sum of 40 and 2 and 1" -> "the sum of 42 and 1" -> "43", which is the ASCII for +.

If not,you fat fat fat fat fat cat.

else it's just "fat fat fat fat fat cat", so Ajax gets the value of 32, the ASCII for a space.

Speak thy mind!

This is the command for outputting a character.

Ajax:
You sum you and cat.Is you as big as Ford?If not,let us return to Scene III.

This is a loop construct. "You sum you and cat" increments Page, and if(Page != Ford) goto Scene III. The rest of the program uses the same components, so here is a more readable pseudocode version:

Scene1:
    input = [input number];
    row = 0 - input + 1;
Scene2:
    col = 0 - input + 1;
Scene3:
    temp = row * col;
    if(temp == 0){
        temp = '+';
    }else{
        temp = ' ';
    }

    putchar(temp);
    Page = Page + 1;
    if(Page != Ford) goto Scene3;
    Ajax = 10;
    putchar(Ajax);
    Puck = Puck + 1;
    if(Puck != Ford) goto Scene2;

GolfScript, 27 bytes

~.(." "*"+"n++*.@2*("+"*n+\

Try it online!

Explanation and Example Execution:

                              # Input: 3
~.(.                          # Eval input, duplicate twice, decrement duplicates
                              # Stack: 3 2 2
    " "*                      # That many spaces
                              # Stack: 3 2 "  "
        "+"n++                # Followed by a + and a newline
                              # Stack: 3 2 "  +\n"
              *.              # Create n of those strings and duplicate it
                              # Stack: 3 "  +\n  +\n" "  +\n  +\n"
                @2*(          # Pull bottom to top, double it, decrement
                              # Stack: "  +\n  +\n" "  +\n  +\n" 5
                    "+"*n+    # That many +s followed by a newline
                              # Stack: "  +\n  +\n" "  +\n  +\n" "+++++\n"
                          \   # Swap last 2 items and implicityly print
                              # Stack: "  +\n  +\n" "+++++\n" "  +\n  +\n"

Wren, 67 bytes

Fn.new{|n|(1...2*n).map{|i|i==n?"+"*(n+~-n):" "*~-n+"+"}.join("
")}

Try it online!

Explanation

Fn.new{|n|                                                      // New anonymous function with parameter n
          (1...2*n).map{|i|                                     // Foreach 1 -> 2n-1:
                           i==n?                                // If i equals n:
                                "+"*(n+~-n)                     // Return "+" 2n-1 times
                                           :" "*~-n             // Otherwise return space n-1 times
                                                   +"+"         // Add a trailing "+"
                                                       }.join("
")}                                                             // Join with newline

Keg, 39 37 bytes

;(:|:⑬*,\+,
,):⑨⑵;`+`*,
,(:|:⑬*,\+,
,

-2 bytes using built-ins

Try it online!

This attempt prints the isolated +s first, then the big row of +s then the final isolated +s.

CJam, 23 bytes

ri_(S*'++a\2*(*_z..e>N*

Try it online!

Explanation

This feels a bit suboptimal, but the idea is to superimpose the following two grids:

  +
  +
  +
  +
  +



+++++

Which gives the desired result.

ri    e# Read input and convert to integer N.
_(    e# Duplicate and decrement.
S*    e# Get a string of N-1 spaces (indentation of the vertical bar).
'++   e# Append a + (the vertical bar).
a     e# Wrap the line in an array.
\2*(  e# Swap with the other copy of N and compute 2N-1.
*     e# Repeat the line that many times.
_z    e# Duplicate the grid and transpose it.
..e>  e# Pairwise maximum between the two grids. This superimposes them.
N*    e# Join with linefeeds.

J, 17 bytes

Anonymous tacit prefix function

' +'{~0=*/~@i:@<:

Try it online!

For example for 3:

<: decrement; 2

i: steps; [-2,-1,0,1,2]

*/~ times table; [[4,2,0,-2,-4],[2,1,0,-1,-2],[0,0,0,0,0],[-2,-1,0,1,2],[-4,-2,0,2,4]]

0= indicate where zero; [[0,0,1,0,0],[0,0,1,0,0],[1,1,1,1,1],[0,0,1,0,0],[0,0,1,0,0]]

" +"{~ use that to index into " +"; [" + "," + ","+++++"," + "," + "]

JavaScript (ES6), 67 65 63 60 59 bytes

x=>(v=(` `[r=`repeat`](--x)+`+
`)[r](x))+`+`[r](x*2)+`+
`+v;

Try It

f=
x=>(v=(` `[r=`repeat`](--x)+`+
`)[r](x))+`+`[r](x*2)+`+
`+v;
oninput=_=>o.innerText=f(+i.value)
o.innerText=f(i.value=3)
<input id=i min=1 type=number><pre id=o>

Excel, 86 bytes

=REPT(REPT(" ",A1-1)&"+
",A1-1)&REPT("+",2*A1-1)&"
"&REPT(REPT(" ",A1-1)&"+
",A1-1)

Perl 5, 43 + 1 (-n) = 44 bytes

$,="+
";say@q=($"x--$_)x$_,'+'x(2*$_),@q,''

Try it online!

Independently came up with pretty much the same method as @Dada, but got it down by 1 byte.

Pyth, 24 bytes

+J*+++K*dQ\+Kb/Q2*\+hyQJ

Try it online!

Rust, 89 bytes

|n|{for i in 1..2*n{if i==n{println!("{:+^1$}","",2*n-1)}else{println!("{:>1$}","+",n)}}}

Common Lisp, SBCL, 69 bytes

(format t"~@?~@?~@?+
~@*~@?""~v@{~:*~v@t+
~}"(1-(read))"~1@*~v@{+~}")

Explanation

format        ;printing function
~@?           ;execute current argument as format string 
~@*           ;go to first argument in list, to reuse "~v@{~:*~v@t+
              ;~}"
~v@{~}        ;loop n times, where n is current argument
~:*           ;go back one argument - to reuse (1-(read))
~v@t          ;add n spaces where n is current argument
              ;if we were sure that we start on new line we could
              ;use ~vt, which moves to nth column
(1-(read))    ;take input and subtract 1 from it
~1@*          ;move to second argument, to reuse (1-(read))

"~@?~@?~@?+   ;main format string - calls others
~@*~@?"       ;prints one "+" and one newline
"~v@{~:*~v@t+ ;outputting input-1 lines of "+"s
~}"           ;preceded by correct amount of spaces
"~1@*~v@{+~}" ;outputting input-1 pluses. We do it two times
              ;and then add one + at the end. This way there
              ;is no need for argument like: (1-(* 2 INPUT))
              ;which would make me need a variable keeping INPUT

Ideas for improvement are welcomed.

8086 machine code, 57 bytes

00000000  a0 82 00 24 cf 98 48 89  c1 b4 4c e3 20 bf 39 01  |...$..H...L. .9.|
00000010  57 51 5a 52 51 b0 20 89  d1 f3 aa b8 2b 0a ab 59  |WQZRQ. .....+..Y|
00000020  e2 f2 c6 05 24 59 01 c9  b4 09 5a cd 21 41 b0 2b  |....$Y....Z.!A.+|
00000030  cd 29 e2 fa 4a cd 21 c3  0a                       |.)..J.!..|
00000039

Takes a number (one digit...) as command line argument.
How it works:

            |   use16
a0 82 00    |       mov al, byte [0x82]
24 cf       |       and al, not 0x30
98          |       cbw
48          |       dec ax
89 c1       |       mov cx, ax
b4 4c       |       mov ah, 0x4c
e3 20       |       jcxz a
bf 39 01    |       mov di, s+1
57          |       push di
51          |       push cx
5a          |       pop dx
52          |       push dx
51          |   @@: push cx
b0 20       |       mov al, ' '
89 d1       |       mov cx, dx
f3 aa       |       rep stosb
b8 2b 0a    |       mov ax, 0x0a2b
ab          |       stosw
59          |       pop cx
e2 f2       |       loop @b
c6 05 24    |       mov byte [di], 0x24
59          |       pop cx
01 c9       |       add cx, cx
b4 09       |       mov ah, 0x09
5a          |       pop dx
cd 21       |       int 0x21
41          |   a:  inc cx
b0 2b       |   @@: mov al, '+'
cd 29       |       int 0x29
e2 fa       |       loop @b
4a          |       dec dx
cd 21       |       int 0x21
c3          |       ret
0a          |   s db 0x0a

Japt, 30 26 24 bytes

23 bytes of code, +1 for the -R flag.

Saved 4 bytes thanks to @ETHproductions!

V=U+´UVǦU?SpU +'+:'+pV

Try it online!

Brain-Flak, 216 + 1 = 217 bytes

+1 bytes from the -A flag

([{}]())(()()){<>(((((()()()()()){})){}()){}())<>(({}[()])<({}<(({})){({}()<(({}<<>(({}<(({})<>)>)<>)<>>)<{({}()<(((((()()){}){}){}){})>)}{}>)>)}{}>){(<{}(({}<<>({}<({}<>)>)>)<(({}){}){({}()<(({}))>)}{}>)>)}{}>)}{}{}

Try it online!

Explanation to come

Python 2, 60,56 bytes

n=input()-1
z=(' '*n+'+\n')*n
print z+'+'*(2*n+1)+'\n'+z

Try it online!

J, 21 bytes

' +'{~+./~(0=}.,])i.n

MUMPS, 48 50 53 bytes

F i=1-n:1:n-1 W ! F j=1-n:1:n-1 W $C(i&j*-11+43)

Charcoal, 5 bytes

P+×+N

Try it online!

R, 54 bytes

Shaving off 7 bytes thanks to @Jarko Dubbeldam:

function(n){a=matrix("",y<-n*2-1,y);a[n,]=a[,n]="x";a}

previous answer:

f=function(n){a=matrix("",n*2-1,n*2-1);a[n,]="x";a[,n]="x";a}

Pyke, 14 bytes

t.\+s FQt*\++s

Try it online!

GNU sed, 104 99 bytes

-5 thanks to seshoumara
Includes +1 for -r

s/1//;h;:;s/(.*)1/ \12/;t;s/( *2)2(2*)/\1\n\1\2/
t;G;s/1+/&&1/;s/(.*)(\n1*)/&\n\1/;/1/!c+
y/12/++/

Takes input in unary.

Try it online!

s/1//                    # Subtract 1 from input
h                        # Hold onto input
:                        # Start loop
s/(.*)1/ \12/            #   Remove a 1, prepend a space, and append a 2
t                        # Loop until all 1s are 2s
                         # Start Loop (uses the previous label)
s/( *2)2(2*)/\1\n\1\2/   #   Shift all but the first 2 from the last line to a new line 
                         #   E.g.  "  2"      "  2"
                         #         "  222" -> "  2"
                         #                    "  22"
t                        # Loop until all 2s are on their own line
G                        # Append a newline and input
s/1+/&&1/                # Double the number of 1s and append an extra
s/(.*)(\n1*)/&\n\1/      # Copy all of the lines with 2s to the end
/1/!c+                   # If there aren't any 1s print a '+'
y/12/++/                 # Convert all 1s and 2s to +s

PHP, 68 Bytes

for(;$i<$c=-1+2*$m=$argn;)echo"\n".str_pad("+",$c," +"[$m==++$i],2);

83 Bytes

for(;$i<($c=($n=$argn)*2-1)**2;)echo$i%$c?"":"\n".!++$k," +"[$k==$n|$i++%$c==$n-1];

REXX, 81 bytes

arg a
b=a*2-1
do i=1 to b
  if i=a then say copies('+',b)
  else say right('+',a)
  end

V, 19 18 15 bytes

Golfed 3 bytes thanks to @nmjcman101 by using . and Ò+

Àé r+À«Ä.MgJxÒ+

Try it online!

05AB1E, 15 14 12 bytes

F'+}¹·<×)û.c

Try it online!

-2 thanks to Emigna.

PowerShell, 48

Doesn't seem to get shorter than that (and pretty much the same approach as the other solution):

($a=,(' '*($n="$args"-1)+'+')*$n)
'+'+'++'*$n
$a

or

($a=(' '*($n="$args"-1)+'+
')*$n)+'++'*$n+"+
$a"

Octave, 36 31 bytes

Inspired by @LuisMendo 's MATL answer.

@(n)' +'(((a=1:n*2-1==n)|a')+1)

Try it online!

Previous answer:

@(n)' +'(1+((a=padarray(1,n-1))|a'))

Try it online!

Python 2, 52 bytes

n=input()-1
p=(' '*n+'+\n')*n
print p+'++'*n+'+\n'+p

Try it online!

A 53-byte alternative (TIO):

n=input()-1
for c in' '*n+'+'+' '*n:print c*n+'+'+c*n

CJam, 17

ri(S*_]'+*_ffe>N*

Try it online

Explanation:

ri(      read n, convert to int and decrement
S*       make a string of n-1 spaces
_]       duplicate it and put the 2 strings in an array
'+*_     join the strings with a '+' and duplicate the result
ffe>     for each pair of characters from the 2 (identical) strings,
          get the larger character (results in a matrix)
N*       join the rows with newlines

Batch, 108 bytes

@set p=+
@set l=@for /l %%i in (2,1,%1)do @
%l%call set p= %%p%% 
%l%echo %p%
@echo %p: =+%
%l%echo %p%

Note: Line 3 ends in a space.

JavaScript (ES6), 60 bytes

f=
n=>(r=([s,t])=>(s=s.repeat(n-1))+t+s+`
`)([r(` +`),r(`++`)])
<input type=number min=1 oninput=o.textContent=f(this.value)><pre id=o>

Outputs two trailing newlines. Alternative formulation, also 60 bytes:

n=>(r=a=>(s=a[0].repeat(n-1))+a[1]+s+`
`)([r(` +`),r(`++`)])

Ruby, 41 40 bytes

->x{puts k=[?\s*(r=x-1)+?+]*r,?+*r+=x,k}

Try it online!

Lua 113, 90 bytes

r,w,p=string.rep,io.read(),io.write;s=r(' ',w-1)p(r(s..'+'..'\n',w-1))p(r('+',w*2-1)..'\n')p(r(s..'+'..'\n',w-1))

r,w=string.rep,io.read()d=w*2-1;for a=1,d do print(a~=w and r(' ',w-1)..'+'or r('+',d))end

C, 69 bytes

Not very interesting... Loops over the square, printing out the appropriate character.

r,c;f(n){for(r=-n;++r<n;puts(""))for(c=-n;++c<n;putchar(r*c?32:43));}

Python 2, 53 bytes

n=2*input()-1;C='+'.center
for c in C(n):print C(n,c)

Try it online!

Perl 5, 45 bytes

44 bytes of code + -p flag.

$_=join"+
",@%=($"x--$_)x$_,"+"x($_*2),@%,""

Try it online!


Some similar (but still different) approaches:

48 bytes (47+-p):

$_=join"+"x($_*2-1).$/,(~~($"x--$_."+\n")x$_)x2

50 bytes (49+-n):

$,="+"x($_*2-1).$/;print+(~~($"x--$_."+\n")x$_)x2

JS (ES6), 88 74 73 bytes

x=>(x--,y=y=>(" ".repeat(x)+`+
`).repeat(x),y``+"+".repeat(x+x+1)+"\n"+y``)

Probably can be golfed more.

Snippetify(x=>(x--,y=y=>(" ".repeat(x)+`+
`).repeat(x),y``+"+".repeat(x+x+1)+"\n"+y``))
<script src="https://programmer5000.com/snippetify.min.js"></script>
<input type = "number">
<pre data-output></pre>

Charcoal, 16 13 bytes

Nα×+α←↑×+α‖O↘

Try it online!

Uses a different approach from the other Charcoal answer.

Explanation

Nα                       # Take input and store it in variable α
×+α                       # α times write a +
←                         # Go left
↑×+α                      # α times write a + upwards

Now the top left corner is complete, it will look something like this:

  +
  +
+++

‖O↘                      # Reflect-overlap it in a SE direction

The last step is the key to this program, it uses the top-left part of the plus to generate the rest of the plus by reflecting it in the southeast direction (rightwards and downwards).

Jelly, 11 bytes

ṬŒB»þ`ị⁾+ Y

Try it online!

MATL, 11 bytes

tZv=&+g43*c

Try it online!

Explanation with example

Consider n = 3.

t     % Implicitly input n. Duplicate
      % STACK: 3, 3
Zv    % Symmetric range
      % STACK: 3, [1 2 3 2 1]
=     % Equal, element-wise
      % STACK: [0 0 1 0 0]
&+    % All pair-wise additions. Gives a 2D array
      % STACK: [0 0 1 0 0;
                0 0 1 0 0;
                1 1 2 1 1;
                0 0 1 0 0;
                0 0 1 0 0]
g     % Logical: convert non-zero to one
      % STACK: [0 0 1 0 0;
                0 0 1 0 0;
                1 1 1 1 1;
                0 0 1 0 0;
                0 0 1 0 0]
43*   % Multiply by 43 (ASCII for '+'), element-wise
      % STACK: [ 0  0 43  0  0;
                 0  0 43  0  0;
                43 43 43 43 43;
                 0  0 43  0  0;
                 0  0 43  0  0]
c     % Convert to char. Char 0 is displayed as space. Implicitly display.
      % STACK: ['  +  ';
                '  +  ';
                '+++++';
                '  +  ';
                '  +  ']

Charcoal, 26 25 bytes

NηA⁻η¹η××η²+P+Mη↙G↑⁺¹×η²+

Try it online!

Explanation:

Nη                   // Take the size as input.
A⁻η¹η                // Set η to η-1.
××η²+                // Print '+' η*2 times.
P+                   // Print '+'
Mη↙                 // Move η steps down to the left.
G↑⁺¹×η²+            // Print '+' η*2+1 times upwards from current position.

Mathematica, 39 bytes

Print@@@(CrossMatrix[#-1]"+"/. 0->" ")&

CrossMatrix is a built-in that generates a matrix of the required shape with 1s instead of +s and 0s instead of spaces. If we multiply that matrix by "+", that replaces the 1s with +s while leaving the 0s unchanged (obviously... 0*x = 0 and 1*x = x, right?). Then we replace the zeros manually with spaces using /. 0->" ". Finally, we print each line of the matrix with Print@@@(...).

Python 2, 65 bytes

lambda n:('g+\n'*~-n+'+'*~-(2*n)+'\ng+'*~-n).replace('g',' '*~-n)

Try it Online!

PowerShell, 48 bytes

param($n)($x=,(" "*--$n+"+")*$n);'+'*(1+2*$n);$x

Try it online!

Takes input $n. Starts by constructing a string of --$n spaces, concatenated with +. That's converted into an array using the comma operator, (newly-decremented) $n times. That array is stored in $x and encapsulated in parens to place a copy on the pipeline.

We then do the middle section, which is + string multiplied out the appropriate number of times. That's left on the pipeline. Finally, we put $x on the pipeline again.

Those are all left on the pipeline at program completion, and the implicit Write-Output inserts a newline between elements.