//question 1: write a small program that outputs the characters corresponding
//		to variables defined in display.h. Then write one that outputs
//	 	all the characters with ascii codes from 0 to 255.
//         2: run the following program and analyse each part.
//	   3: revise the program so that it draws a rectangle with six small
//	 	rectangles inside it.

#define 	C_UL	218
#define 	C_UR	191
#define 	C_LL 	192
#define 	C_LR	217
#define 	C_XD	194
#define		C_XU	193
#define		C_XR	195
#define 	C_XL	180
#define		C_XX	197
#define		C_H	196
#define		C_V	179
#define		C_ULD	201
#define		C_URD	187
#define		C_LLD	200
#define		C_LRD	188
#define		C_XDD	203
#define		C_XUD	202
#define		C_XRD	204
#define		C_XLD	185
#define		C_XXD	206
#define		C_HD	205
#define		C_VD	186
#define		C_HATCH	176
#define		C_SPACE	255


#include <stdio.h>
#define HEIGHT 		15
#define HALF_HEIGHT	8
#define WIDTH		31
#define HALF_WIDTH	16
//draw some boxes.
int main()
{	int r, c;

	//top row
	putchar(C_UL);
	for (c=2;c<HALF_WIDTH; c++)
		putchar(C_H);
	putchar(C_XD);
	for (c=HALF_WIDTH+1;c<WIDTH; c++)
		putchar(C_H);
	putchar(C_UR);
	putchar('\n');

	//upper half
	for (r=2; r<HALF_HEIGHT; r++) {
		putchar(C_V);
		for (c=2; c<HALF_WIDTH; c++)
			putchar(' ');
		putchar(C_V);
		for (c=HALF_WIDTH+1; c<WIDTH; c++)
			putchar(' ');
		putchar(C_V);
		putchar('\n');
	}
	// middle row
	putchar(C_XR);
	for (c=2;c<HALF_WIDTH; c++)
		putchar (C_H);
	putchar (C_XX);
	for (c=HALF_WIDTH+1;c<WIDTH;c++)
		putchar(C_H);
	putchar(C_XL);
	putchar('\n');

	//lower half
	for (r=2;r<HALF_HEIGHT;r++) {
		putchar(C_V);
		for (c=2; c<HALF_WIDTH; c++)
			putchar(' ');
		putchar(C_V);
		for (c=HALF_WIDTH+1;c<WIDTH;c++)
			putchar(' ');
		putchar(C_V);
		putchar('\n');
	}
	//bottom row
	putchar(C_LL);
	for(c=2;c<HALF_WIDTH;c++)
		putchar(C_H);
	putchar(C_XU);
	for(c=HALF_WIDTH+1;c<WIDTH;c++)
		putchar (C_H);
	putchar(C_LR);
	putchar('\n');
	return 0;
}