#include <stdio.h>
#define HORIZONTAL "|"
#define VERTICAL "—"
#define SPACE " "
typedef struct {
int x;
int y;
} point_t;
typedef struct {
point_t start;
point_t end;
} vector_t;
static int xdraw(vector_t vector);
static int ydraw(vector_t vector);
int main() {
vector_t one = {{2, 3}, {30, 3}};
vector_t two = {{3, 2}, {3, 7}};
vector_t three = {{2, 0}, {30, 0}};
xdraw(one);
ydraw(two);
xdraw(three);
ydraw(two);
xdraw(three);
return 0;
}
static int xdraw(vector_t vector) {
if (vector.start.y >= 1) {
for (int i = 0; i < vector.start.y; i++) {
printf("\n");
}
}
if (vector.start.x >= 1) {
for (int i = 0; i < vector.start.x; i++) {
printf("%s", SPACE);
}
}
int len = vector.end.x - vector.start.x;
for (int i = 0; i < len; i++) {
printf("%s", VERTICAL);
}
printf("\n");
return 0;
}
static int ydraw(vector_t vector) {
int len = vector.end.y - vector.start.y;
for (int i = 0; i < len; i++) {
if (vector.start.x >= 1) {
printf("%s", SPACE);
}
printf("%s\n", HORIZONTAL);
}
return 0;
}