# include # include # include int left = 10, top = 5, right = 70, bottom = 20; void gotoxy( short x, short y ) { HANDLE output_handle = GetStdHandle(STD_OUTPUT_HANDLE) ; COORD position = { x, y } ; SetConsoleCursorPosition( output_handle, position ) ; } void Display(int x, int y, unsigned char element) { gotoxy(x, y); printf("%c", element); } void DrawRectangle() { unsigned char brick = 177; //try different values like 219, 178 for(int x = left; x <= right; x++) { Display(x, top, brick); //top line Display(x, bottom, brick); //bottom line } for(int y = top; y <= bottom; y++) { Display(left, y, brick); //left line Display(right, y, brick); //right line } } void main() { DrawRectangle(); _getch(); }