#include <conio.h>
#include <stdio.h>

void TextWindow(int x1,int y1,int x2,int y2,int fcolor,int bcolor);

void main(void)
{
   clrscr();
   TextWindow(1,1,79,24,LIGHTRED,LIGHTGRAY);
   TextWindow(4,4,76,10,BLUE,BLUE);
   TextWindow(3,3,75,9,YELLOW,GREEN);
   TextWindow(4,13,38,21,RED,RED);
   TextWindow(3,12,37,20,LIGHTCYAN,BROWN);
   TextWindow(43,13,76,21,RED,RED);
   TextWindow(42,12,75,20,LIGHTCYAN,BROWN);
}

void TextWindow(int x1,int y1,int x2,int y2,int fcolor,int bcolor)
/*  TextWindow :  Draw text window on screen */
/*  (x1,y1)    :  Top-left co-ordinate of window */
/*  (x2,y2)    :  Bottom-right co-ordinate of window */
/*  fcolor     :  Forground color */
/*  bcolor     :  Background color */
{
  int x,y;

  /* Set forground and background color */
  textcolor(fcolor);
  textbackground(bcolor);

  /* Draw background */
  for(y=y1+1;y<y2;y++)
  {
    for(x=x1+1;x<x2;x++)
    {
      gotoxy(x,y);
      putch(0x20); /* Put Space character to screen */
    }
    gotoxy(x1,y);putch(0xb3); /* Vertical line */
    gotoxy(x2,y);putch(0xb3);
  }
  gotoxy(x1+1,y1);
    for(x=x1+1;x<x2;x++) putch(0xc4); /* Horizontal line */
  gotoxy(x1+1,y2);
    for(x=x1+1;x<x2;x++) putch(0xc4); /* Horizontal line */
  gotoxy(x1,y1);  putch(0xda); /* Corner line */
  gotoxy(x2,y1);  putch(0xbf);
  gotoxy(x1,y2);  putch(0xc0);
  gotoxy(x2,y2);  putch(0xd9);
}


