Two observations about your code:
1.
Code:
0 < i < x && 0 < j < y
This syntax is most likely not doing what you want it to. Let me try to explain why. The above line is what's called an 'expression', and an expression is a thing which can contain sub-expressions, and is evaluated according to operator precedence. For instance:
Code:
// The individual expressions are evaluated according to the precedence of the operators
y * width + x; // ((y * width) + x);
So when you write
Code:
// Same precedence, but with left to right associativity
4 > 3 > 2; // ((4 > 3) > 2)
This will evaluate to false, because (4 > 3) evaluates to a true or false value, either 1 or 0 (respectively). So picture it being evaluated:
Code:
((4 > 3) > 2);
((1) > 2); // false;
2. You are printing straight to output, which naturally inserts new characters to the right of older ones, and then goes downward (in the same manner that a person reads). This can make drawing difficult, because you are forced to do things in a specific order (eg, draw the top, then sides, then bottom). Instead, what if you mimicked the output by creating a character buffer:
Code:
char output[CONSOLEHEIGHT][CONSOLEWIDTH];
Then you could more easily draw to the array, and then only copy the array to output when the characters for the rectangle are already set (and you can do so in any order).