Break it down into smaller parts, think about each of these smaller parts of the problem and get each to work before trying to put it all together.
To start lets get the top and bottom row to work.
Is the top and bottom row the same?
As it is we only need one code block to create it and call this code once for the first/top row and again on the bottom / last row.
The for loop needs to print a character for each column.
Code:
for (y = 0; y < cols; y++)
We need a '+' at each corner and a '-' for each column in between.
This is an 'IF'
Code:
if (y == left corner OR y == right corner)
print '+'
else
print '-'
So what values are the corners at? (remember we are using zero based arrays)
Get this to work and then we can move on to the rows.
With the rows, for the top and bottom rows we need to call the column code (above) otherwise we need to print a wall ('I') at the edges.
We need a FOR loop that runs for each row (which you already have).
Then again an 'IF' to decide what to print
Code:
if (x == top OR x == bottom)
call the column loop
else
print 'I'
EDIT: This code will not work for the wall rows (not top and bottom) It will not print the right hand 'wall' only the left wall.
We need another column printing loop to print the right wall.
This loop is similar to the top and bottom row
Code:
//wall print
if (y == left corner OR y == right corner)
print 'I'
else
print ' ' (space character)
You will need to work out which column loop to call for each ROW.