Exemple #1
0
void main()
{
int gd=DETECT,gm,maxy,x,style;
char str[40];
struct linesettingstype ls;

initgraph(&gd,&gm,"d:\\tc\\bgi");

maxy=getmaxy();

setcolor(WHITE);
outtextxy(10,20,"Normal Width");

x=20;
for(style=0;style<=4;style++)
	{
	setlinestyle(style,0,1);

	if(style==0)
	   getlinesettings(&ls);

	if(style==4)
	   {
	   setlinestyle(4,15,1);
	   line(x,50,x,maxy-50);
	   }
	else
	   line(x,50,x,maxy-50);

	itoa(style,str,10);
	outtextxy(x,maxy-20,str);
	x=x+50;
	}

outtextxy(375,20,"Thick Width");

x=375;
for(style=0;style<=4;style++)
	{
	setlinestyle(style,0,3);

	if(style==4)
	   {
	   setlinestyle(4,35,3);
	   line(x,50,x,maxy-50);
	   }
	else
	   line(x,50,x,maxy-50);

	itoa(style,str,10);
	outtextxy(x,maxy-20,str);
	x=x+50;
	}

setlinestyle(ls.linestyle,ls.upattern,ls.thickness);

getch();
closegraph();
restorecrtmode();
}
Exemple #2
0
void main()
{
	int gd=DETECT,gm,x,y;
      initgraph(&gd,&gm,"d:\\tc\\bgi");
	x=getmaxx();
	y=getmaxy();
	setcolor(RED);
	rectangle(x-450,y-350,x-350,y-450);

	setcolor(GREEN);
	circle(x-400,y-400,50);

	setcolor(MAGENTA);
	setlinestyle(1,50,3);
 //	line(x-400,y-400,x-400+35,y-400+35);
   //	line(x-400,y-400,x-400-35,y-400+35);
     //	line(x-400,y-400,x-400,y-400-50);
	line(x-400-35,y-400+35,x-400,y-400-50);
	line(x-400+35,y-400+35,x-400,y-400-50);
	line(x-400+35,y-400+35,x-400-35,y-400+35);
	setcolor(BLUE);
	putpixel(x-400,y-400,RED);
	getch();
	closegraph();
	restorecrtmode();
}
Exemple #3
0
main()
{
int driver, mode;
int status;
char buf[1000];
	driver = DETECT;
	mode = VGAHI;

	initgraph (&driver, &mode, "");
	status = graphresult ();
	if (status != grOk)
	{
		printf ("Erreur initgraph %d 0x%X\n", status, status);
		return;
	}

	putpixel (120, 130, 1);
	{
	int i;
		for (i=0; i<150; i++)
		{
			putpixel (i, i, i*16/150);
		}
	}

	interf ();

	gets (buf);
	sleep (1);
	restorecrtmode ();
	printf ("status = %d\n", status);
}
Exemple #4
0
static void Initplot(void) {
#if !defined(__GO32__)
	registerfarbgidriver(EGAVGA_driver_far);
	registerfarbgidriver(CGA_driver_far);
	registerfarbgidriver(Herc_driver_far);
	registerfarbgifont(triplex_font_far);
#endif

	graphdev = DETECT;
	initgraph(&graphdev, &graphmode,"c:\\bc\\bgi");
	{int err;
		graphdev=1;
		err = graphresult();
		if (err != grOk) {
hoc_execerror("Error in initializing graphics adaptor\n", (char *)0);
		}
		xres = (double)(getmaxx()+1);
		yres = (double)(getmaxy()+1);
		grx_txt_clear();
		return;
	}
	if (graphdev > 0) {
		xres = (double)(getmaxx()+1);
		yres = (double)(getmaxy()+1);
		restorecrtmode();
	} else {
hoc_execerror("Error in initializing graphics adaptor\n", (char *)0);
	}
}
Exemple #5
0
void main()
{
	int gd=DETECT, gm, maxx, maxy, x, y, button;

	initgraph(&gd, &gm, "c:/tc/bgi");
	maxx=getmaxx();
	maxy=getmaxy();

	rectangle(0,56,maxx,maxy);
	setviewport(1,57,maxx-1,maxy-1,1);

	gotoxy(26,1);
	printf("DEMONSTRATION : MOUSE IN C");
	gotoxy(28,2);
	printf("BY: OSHO PRAKASH GIRI");

	if(initmouse()==0)
	{
		closegraph();
		restorecrtmode();
		printf("\nMOUSE DRIVER NOT LOADED");
		exit();
	}

	restrictmouseptr(1,57,maxx-1,maxy-1);
	showmouseptr();

	getch();
}
void main (){

int gdriver=0,gmode,opc,opc1,opc2,opc3,opc4,opc5,opc6,opc7,opc8,opc9;
float Periodos,Tasa;

initgraph(&gdriver,&gmode," ");
mouse.Inicializar(); //Inicializa Mouse

boton(90,70,500,300,8,15,7,5);
barra_titulo(92,72,499,"Ingreso De Datos - Mac Software");
DibujeIcono(97,73,Network(),16,16);
boton(483,75,495,87,8,15,7,1);DibujeIcono(485,77,Cerrar(),9,9);
marco_grabado(100,98,490,290);
Periodos=CuadroDato(115,"Digite Numero de Periodos","");
Tasa=CuadroDato(185,"Digite Tasa de Interes","");
conv_text(125,253,"NOTA: ");
conv_text(125,268,"EL PERIODO CERO (0) ES EL MOMENTO INICIAL");
getch();
cleardevice();
printf("Periodo= %f  Tasa=%f",Periodos,Tasa);


getch();
closegraph();exit(0);restorecrtmode();system("cls");


} //FIN
//*screen 1*//
void screen1()
 {
 int gd=DETECT,gm;
 initgraph(&gd,&gm,PATH);
 setfillstyle(SOLID_FILL,RED);
 bar(0,0,640,480);
 setfillstyle(SOLID_FILL,WHITE);
 bar(15,15,625,465);
 setfillstyle(SOLID_FILL,RED);
 //*for filling color*//
 bar(30,30,610,450);
 //*for constructing 2D bar*//
 settextstyle(1,0,8);
 setcolor(WHITE);
 outtextxy(190,35,"JIIT");
 setfillstyle(SOLID_FILL,LIGHTGRAY);
 bar3d(180,140,385,130,20,20);
 //* for costruct a 3D bar*//
 outtextxy(160,150,"MEDICAL");
 bar3d(140,255,440,245,20,20);
 outtextxy(165,270,"STORE");
 bar3d(145,375,440,365,20,20);
 getch();
 closegraph();
 restorecrtmode();
 //*restore the original video mode detected by initgraph*//
 }     //*here screen 1 coplete*//
Exemple #8
0
void main()
{
	int gd=DETECT,gm,x,y;
	char *a={"EMPTY_FILL"};
      initgraph(&gd,&gm,"d:\\tc\\bgi");
	x=getmaxx();
	y=getmaxy();
	setcolor(RED);
//	setfillstyle(SOLID_FILL,GREEN);
  //	floodfill(x-400,y-100,RED);
  setbkcolor(GREEN);
       //	setcolor(RED);
      //	setfillpattern(0*22,WHITE);
	rectangle(x-450,y-350,x-350,y-450);

/*setcolor(GREEN);
	circle(x-400,y-400,50);

	setcolor(MAGENTA);
	setlinestyle(1,50,3);
 //	line(x-400,y-400,x-400+35,y-400+35);
   //	line(x-400,y-400,x-400-35,y-400+35);
     //	line(x-400,y-400,x-400,y-400-50);
	line(x-400-35,y-400+35,x-400,y-400-50);
	line(x-400+35,y-400+35,x-400,y-400-50);
	line(x-400+35,y-400+35,x-400-35,y-400+35);
	setcolor(BLUE);
	putpixel(x-400,y-400,RED); */
//	outtextxy(x-450,y-450,&a);

	getch();
	closegraph();
	restorecrtmode();
}
char file()
{
	int gd=DETECT, gm;
	int i;
	initgraph(&gd,&gm,"c:\\tc\\bgi");
	setcolor(RED);
	rectangle(170,85,430,385);
	rectangle(175,90, 425,380);
	setcolor(GREEN);
	settextstyle(7,0,4);
	outtextxy(130,45,"THE MEDICAL SHOP.");
	settextstyle(7,0,3);
	frame();
	setcolor(YELLOW);
	outtextxy(260,95,"MENU");
	settextstyle(0,0,0);
	setcolor(MAGENTA);
	outtextxy(200,145,"1>>ADD A NEW MEDICINE.");
	outtextxy(200,170,"2>>SEARCH A MEDICINE.");
	outtextxy(200,195,"3>>EXIT.");

	setcolor(GREEN+BLINK);
	outtextxy(200,360,"ENTER YOUR CHOICE:1/2/3.");
	setcolor(RED);
	outtextxy(480,350,"made by:");
	setcolor(BLUE);
	outtextxy(480,370,"AYUSH JAIN (9103553)");

	i=getch();
	restorecrtmode();
	return (i);
}
void end()
{
	int i,j,k;
	int gd=DETECT,gm;

	initgraph(&gd,&gm,"c:\\tc\\bgi");

	setbkcolor(BROWN);
	setcolor(RED);
	settextstyle(1,0,8);

	outtextxy(130,50,"_-~Search~-_");
	setcolor(RED);
	settextstyle(1,0,8);
	outtextxy(10,190,"_-~For me~-_");
	settextstyle(7,0,3);
	setcolor(RED);
	setcolor(10+BLINK);
	outtextxy(300,300,"THANK YOU");
	setcolor(10);
	outtextxy(300,355,"Have a nice day.....");
	setcolor(4);

	for(k=0;k<640;k++)
	{
	    if(k==635)
		{
		     for(j=0;j<480;j++)
			  {
			      circle(635,j,4);
			      delay(1);
			  }
		}
	    else
		{
		     circle(k,5,5);
		     delay(1);
		}
	}

	for(k=639;k>(-1);k--)
	     {
		  if(k==0)
		      {
			   for(j=475;j>0;j--)
				{
				    circle(5,j,5);
				    delay(1);
				 }
	     }
	 else
	      {
		   circle(k,475,4);
		   delay(1);
	      }
	}

	restorecrtmode();
}
void first()
{
	int i,j,k;
	int gd=DETECT,gm;
	initgraph(&gd,&gm,"c:\\tc\\bgi");

	setbkcolor(BROWN);
	setcolor(RED);
	settextstyle(1,0,8);
	outtextxy(130,50,"_-~Search~-_");
	setcolor(RED);
	settextstyle(1,0,8);
	outtextxy(10,190,"_-~For Me~-_");
	settextstyle(7,0,3);
	setcolor(RED);
	setcolor(10);
	
	setcolor(4);

	for(k=0;k<640;k++)
	{
	    if(k==635)
		{
		     for(j=0;j<480;j++)
			  {
			      circle(635,j,4);
			      delay(1);
			  }
		}
	    else
		{
		     circle(k,5,5);
		     delay(1);
		}
	}

	for(k=639;k>(-1);k--)
	     {
		  if(k==0)
		      {
			   for(j=475;j>0;j--)
				{
				    circle(5,j,5);
				    delay(1);
				 }
	     }
	 else
	      {
		   circle(k,475,4);
		   delay(1);
	      }
	}

	getch();
	restorecrtmode();
}
Exemple #12
0
void
bgi_text(PLStream *pls)
{
	 if (pls->graphx == GRAPHICS_MODE) {
	if (page_state == DIRTY)
		 pause(pls);
	restorecrtmode();
//      _setvideomode(_DEFAULTMODE);
	pls->graphx = TEXT_MODE;
	 }
}
Exemple #13
0
/*
 *    for demonstration purpose only.
 */
int main(void)
{
	int gd=DETECT, gm;
	initgraph(&gd, &gm, "");

	antz(10);               /* change 10 to get the number of ants you want */

	closegraph();
	restorecrtmode();
	return 0;
}
Exemple #14
0
void main()
{
	int gd=DETECT,gm,maxx,maxy,x,y,button;

	initgraph(&gd,&gm,"C:\\TC");
	maxx=getmaxx();
	maxy=getmaxy();

	rectangle(0,56,maxx,maxy);
	setviewport(1,57,maxx-1,maxy-1,1);

	gotoxy(26,1);
	printf("MOUSE DEMONSTRATION PROGRAM");

	if(initmouse()==0)
	{
		closegraph();
		restorecrtmode();
		printf("\nMouseDriver not loaded");
		exit(0);
	}

	restrictmouseptr(1,57,maxx-1,maxy-1);
	showmouseptr();

	gotoxy(1,2);
	printf("Left Button");

	gotoxy(15,2);
	printf("Right Button");

	gotoxy(55,3);
	printf("Press Any Key to Exit...");

	while(!kbhit())
	{
		getmousepos(&button,&x,&y);

		gotoxy(5,3);
		(button & 1)==1? printf("DOWN") : printf("UP  ");

		gotoxy(20,3);
		(button & 2)==2? printf("DOWN") : printf("UP  ");

		gotoxy(65,2);
		printf("x=%03d y=%03d",x,y);
	}
}
Exemple #15
0
int main() {
	int unidad = 0,modo;

	initgraph (&unidad,&modo,"c:\\bc\\bgi");
	if (graphresult() != 0) {
		cout << "Error al tratar de pasar al modo grafico\n";
		getch();
		return 1;
	}
	outtext ("Modo Grafico");
	getch();
	restorecrtmode();
	cout << "De nuevo en modo texto" << endl;
	getch();
	return 0;
}
void main()
{
	int gd=DETECT,gm,x=40,y=40,maxx,maxy,fst;
	char str[40];
	char *pattern[]={
				"EMPTY_FILL",
				"SOLID_FILL",
				"LINE_FILL",
				"LTSLASH_FILL",
				"SLASH_FILL",
				"BKSLASH_FILL",
				"LTBKSLASH_FILL",
				"HATCH_FILL",
				"XHATCH_FILL",
				"INTERLEAVE_FILL",
				"WIDE_DOT_FILL",
				"CLOSE_DOT_FILL",
				"USER_FILL",
			};
	initgraph(&gd,&gm,"c:\\tc\\bgi");
	maxx=getmaxx();
	maxy=getmaxy();
	rectangle(0,10,maxx,maxy);
	setcolor(WHITE);
	outtextxy(175,0,"Pre-defined Fill styles");

	for(fst=0;fst<12;fst++)
	{
		setfillstyle(fst,RED);
		bar(x,y,x+80,y+80);
		rectangle(x,y,x+80,y+80);
		itoa(fst,str,10);
		outtextxy(x,y+100,str);
		outtextxy(x,y+110,pattern[fst]);

		x=x+150;
		if(x>490)
		{
			y=y+150;
			x=40;
		}
	}
	getch();
	closegraph();
	restorecrtmode();
}
Exemple #17
0
main()
{
	int driver, mode;
	driver = DETECT;

	initgraph(&driver, &mode, "");
	setbkcolor(YELLOW);
	setcolor(RED);
	ellipse(100, 100, 0, 360, 80, 40);
	floodfill(100, 100, RED);
	setcolor(CYAN);
	circle(320, 100, 80);
	setfillstyle(8, 5);
	floodfill(320, 100, CYAN);
	getch();
	restorecrtmode();
}
Exemple #18
0
void main()
{
	int gd=DETECT,gm;
	int midx,midy,i,j;
	char msg[80]="Hello,Good Morning";
	char msg1[80],msg2[80];
	char *horizontal[]={
				"LEFT_TEXT",
				"CENTER_TEXT",
				"RIGHT_TEXT"
			};
	char *vertical[]={
				"BOTTOM_TEXT",
				"CENTER_TEXT",
				"TOP_TEXT"
			};
	initgraph(&gd,&gm,"c:\\tc\\bgi");
	midx=getmaxx()/2;
	midy=getmaxy()/2;

	/*loop through text justifications*/

	for(i=LEFT_TEXT;i<=RIGHT_TEXT;i++)
	{
		for(j=BOTTOM_TEXT;j<=TOP_TEXT;j++)
		{
			cleardevice();
			cross(midx,midy);  /*create cross hairs on screen*/
			settextjustify(i,j);
			outtextxy(midx,midy,msg);
			settextjustify(LEFT_TEXT,TOP_TEXT);
			outtextxy(100,350,"HORIZONTAL JUSTIFICATION=");
			sprintf(msg1,"%s",horizontal[i]);
			outtextxy(320,350,msg1);
			outtextxy(100,400,"VERTICAL JUSTIFICATION=");
			sprintf(msg2,"%s",vertical[j]);
			outtextxy(320,400,msg2);

			getch();
		}
	}

	closegraph();
	restorecrtmode();
}
Exemple #19
0
void main()
{
int gd=DETECT,gm,maxx,maxy,x,y,button,prevx,prevy;

initgraph(&gd,&gm,"d:\\tc\\bgi");

printf("Freehand drawing  with the mouse");

maxx=getmaxx();
maxy=getmaxy();
rectangle(0,0,maxx,maxy);
setviewport(1,1,maxx-1,maxy-1,1);

if(initmouse()==0)
	{
	closegraph();
	restorecrtmode();
	printf("Mouse driver not loaded");
	exit(1);
	}

restrictmouseptr(1,1,maxx-1,maxy-1);
showmouseptr();

while(!kbhit())
	{
	getmousepos(&button,&x,&y);
	if((button & 1)==1)
		{
		hidemouseptr();
		prevx=x;
		prevy=y;

		while((button & 1)==1)
			{
			line(prevx,prevy,x,y);
			prevx=x;
			prevy=y;
			getmousepos(&button,&x,&y);
			}

		showmouseptr();
		}
	}
}
Exemple #20
0
main()
{
int driver, mode;
int status;
char buf[1000];

	defsources ();

/*
	driver=HERCMONO;
	mode=HERCMONOHI;
*/
/*
	printf ("Driver ? ");
	scanf ("%d", &driver);
	printf ("Mode ? ");
	scanf ("%d", &mode);
*/
	detectgraph (&driver, &mode);
#ifdef GRAPH
	initgraph (&driver, &mode, "");
	status = graphresult ();
	if (status != grOk)
	{
		printf ("Erreur initgraph %d 0x%X\n", status, status);
		return;
	}
#endif
/*
	putpixel (120, 130, 1);
	{
	int i;
		for (i=0; i<150; i++)
		{
			putpixel (i, i, 1);
		}
	}
*/
	interf ();

	gets (buf);
	sleep (1);
	restorecrtmode ();
	printf ("status = %d\n", status);
}
Exemple #21
0
main( )
{ 

int gd = DETECT, gm ;
int drawtree ( int x1, int y1, float a, float l, float f, int n ) ;
initgraph ( &gd, &gm, "d:\\tc\\bgi" ) ;

 

drawtree ( 280, 350, 270, 60, 90, 6 ) ;

 

getch( ) ;
closegraph( ) ;
restorecrtmode( ) ;

}
Exemple #22
0
main()
{
	int shape[10] = {
		 50,  50,
		100, 150,
		200, 150,
		350,  90,
		 50,  50
	};
	int driver, mode;
	driver = DETECT;
	initgraph(&driver, &mode, ""),
	setbkcolor(CYAN);
	setcolor(RED);
	drawpoly(5, shape);
	getch();
	restorecrtmode();
}
Exemple #23
0
void main()
{
	int gd=DETECT,gm,maxx,maxy,x,y,button;

	initgraph(&gd,&gm,"c:\\tc\\bgi");
	maxx=getmaxx();
	maxy=getmaxy();

	rectangle(0,56,maxx,maxy);
	setviewport(1,57,maxx-1,maxy-1,1);
	gotoxy(26,1);
	printf("Mouse Demonstration Program!");

	if(initmouse()==0)
	{
		closegraph();
		restorecrtmode();
		printf("Mouse driver not loaded");
		exit(1);
	}
	restrictmouseptr(1,57,maxx-1,maxy-1);
	showmouseptr();
	gotoxy(1,2);
	printf("Left Button");
	gotoxy(15,2);
	printf("Right Button");
	gotoxy(55,3);
	printf("Press any key to exit");

	while(!kbhit())
	{
		getmousepos(&button,&x,&y);

		gotoxy(5,3);
		(button&1)==1 ? printf("DOWN"):printf("UP");

		gotoxy(20,3);
		(button&2)==2 ? printf("DOWN"):printf("UP");

		gotoxy(65,2);
		 printf("X=%03d y=%03d",x,y);

	}
}
Exemple #24
0
void main()
{
int gd=DETECT,gm,i,j,x,y,color,startcolor,height,width;
struct palettetype palette;
struct viewporttype vp;

initgraph(&gd,&gm,"d:\\tc\\bgi");

getpalette(&palette);

rectangle(0,20,639,479);
outtextxy(200,10,"Palette demonstration");
getviewsettings(&vp);
width=(vp.right-vp.left)/16;
height=(vp.bottom-vp.top-20)/16;
x=0;
y=20;
startcolor=0;
for(j=0;j<=15;j++)
	{
	color=startcolor;
	for(i=0;i<=15;i++)
		{
		setfillstyle(SOLID_FILL,color++);
		bar(x,y,x+width,y+height);
		x=x+width+1;
		}
	startcolor++;
	x=0;
	y+=height+1;
	}
getch();

while(!kbhit())
   setpalette(random(16),random(65));

setallpalette(&palette);

getch();
closegraph();
restorecrtmode();
}
Exemple #25
0
void   main()
{
    int     i;
    int     buf[20][28];
    long    l;

    time(&l);
    sRand(l);

    filltri(buf);
    Initialise();
    for(i = 0; i < 5; i++) {
        plottri(buf[i], 28, 1, 7 + 13*i, 0);
        plottri(buf[i+5], 28, 0, 7 + 13*i, 12);
        plottri(buf[i+10], 28, 1, 14 + 13*i, 7);
        plottri(buf[i+15], 28, 0, 14 + 13*i, 19);
    }
    getch();
    closegraph();
    restorecrtmode();
}
void main (){

int gdriver=0,gmode,opc,opc1,opc2,opc3,opc4,opc5,opc6,opc7,opc8,opc9;


initgraph(&gdriver,&gmode," ");

Box(120,40,520,420,"Acerca de Hackerz.Com");boton(425,375,500,395,8,15,7,3);
conv_text(437,382,"Aceptar",0);
Line3D(140,335,500,335);barra_estado(153,80,200,148);
settextstyle(1,0,6);conv_text(158,69,"H",1);conv_text(173,94,"S",1);
settextstyle(10,0,2);conv_text(219,86,"Hackerz Software",1);
settextstyle(0,0,1);conv_text(186,160,"Copyright (c) 1999-2000 Hackerz Software",0);
conv_text(186,178,"All rights Reserved.",0);conv_text(186,210,"Requerimientos:",0);
conv_text(186,230,"  Windows 95/98/NT",0);conv_text(186,250,"  16 MB de Memoria RAM",0);
conv_text(186,270,"  Procesador 486 100 MHZ",0);conv_text(186,290,"  Tarjeta de Video de 1 MB",0);
conv_text(135,350," WARNING: This App was designed by Mac.",0);
conv_text(140,370,"This Software is Shareware.",0);
if (getch()>=0) press(425,375,500,395,8,15,7,3);
//getch();
closegraph();restorecrtmode();system("cls");exit(0);
}
Exemple #27
0
void main()
{
int gd=DETECT,gm,x1=0,y;
int  x=2,y1=2,r=9;
double t=0;
initgraph(&gd,&gm,"");
while(!kbhit())
{
y=y1;
//r=r*r;
//y=y*y;
//t=r-y;
x=sqrt((r*r)-(y*y));
//x1=x;
//putpixel(x,y,RED);
delay(30);
y1++;
}
getchar();
closegraph();
restorecrtmode();
}
Exemple #28
0
 //*for end screen *//
void endscr()
 {
 int gd=DETECT,gm;
 initgraph(&gd,&gm,PATH);
 setfillstyle(SOLID_FILL,RED);
 bar(0,0,640,480);
 setfillstyle(SOLID_FILL,WHITE);
 bar(15,15,625,465);
 setfillstyle(SOLID_FILL,RED);
 bar(30,30,610,450);
 settextstyle(1,0,8);
 setcolor(WHITE);
 outtextxy(190,35,"GET");
 setfillstyle(SOLID_FILL,LIGHTGRAY);
 bar3d(180,140,385,130,20,20);
 outtextxy(160,150,"WELL");
 bar3d(140,255,440,245,20,20);
 outtextxy(165,270,"SOON");
 bar3d(145,375,440,365,20,20);
 getch();
 closegraph();
 restorecrtmode();
 }
void main()
{int gdriver = DETECT, gmode, errorcode,s=0,h=0,m=0;
initgraph(&gdriver, &gmode, "");
errorcode = graphresult();
if (errorcode != grOk){printf("Graphics error: %s\n", grapherrormsg(errorcode));   printf("Press any key to halt:");   getch();   exit(1); }
midx=getmaxx()/2;midy=getmaxy()/2;
drawclock();
synchronize(&h,&m,&s);
while(!kbhit())
{
s++;if(s>59) { s=0;m++;}
if(m>59) {m=0;h++;}
if(h>12) h=1;
settime2(h,m,s);
sound(50);
delay(10);
nosound();
delay(DELAY-20);
}
getch();
closegraph();
restorecrtmode();
}
void main()
{

// VARIABLE DECLARATIONS

int i=0,j=0,a,front=-1,rear=-1;
char ch,ch1;
int item;

// FUNCTION PROTOTYPE DECLARATIONS

void show();
void slidebar(int *rear,int *front);
void showqueuesize();
void slidebar();
void cpoiters();
void drawq();
void moveptrs(int *rear,int *front);
void insertq(int *rear,char c);
void deleteq(int *front);
void qdelete(int q[],int rear,int front);
void hidequeueinfo();
void shownumbers(int x1,int y1,int x2,int y2);
int initmouse();
void getmousepos(int *button,int *x,int *y);
void showmouseptr();
void restrictmouseptr(int a,int b,int c,int d);
void exitbutton(int x1,int y1,int x2,int y2,int e_x,int e_y,int xit_x,int xit_y);
void zoomin();

// CHECKING THE GRAPHICS DRIVER

int gd=DETECT,gm,maxx,maxy,x,y,button;
initgraph(&gd,&gm,"c:\\TC");

// GET THE MAXIMUM X AND Y CO ORDINATES

	maxx=getmaxx();
	maxy=getmaxy();

// DRAW THE BORDER FOR THE WINDOW

	rectangle(0,0,maxx,maxy);

// SET THE AREA WITHIN THE SCREEN WHERE GRAPHICAL O/P DISPLAYED

	setviewport(1,1,maxx-1,maxy-1,1);

// WRITE THE HEADDING

	gotoxy(150,1);
	settextstyle(TRIPLEX_FONT,HORIZ_DIR,3);
	setcolor(WHITE);
	setbkcolor(216);
	settextjustify(0,2);
	outtextxy(220,2," LINEAR QUEUE ");
	setcolor(RED);
	settextstyle(8,HORIZ_DIR,3);
	outtextxy(40,35,"DEVELOPED IN 'C'  : IT'S A KVSM PRODUCT");
	settextstyle(0,HORIZ_DIR,0);

// INITIALIZE MOUSE,IF IT DOESN'T GET INITIALIZED CLOSE GRAPHICS MODE

	if (initmouse()==0)
	{
		closegraph();
		restorecrtmode();
		printf("\nMouse Driver not installed");
		exit(1);
	}

// IF MOUSE DRIVER INITIALISED THEN
// RESTRICT THE MOUSE POINTER WITHIN THE COORDINATES GIVEN GIVEN BELOW

	restrictmouseptr(1,57,maxx-1,maxy-1);

// SHOW THE MOUSE POINTER

	showmouseptr();

// SET THE TEXT COLOR TO WHITE

	setcolor(WHITE);
	line(0,70,getmaxx(),70);
	line(0,400,getmaxx(),400);

	setcolor(14);
	outtextxy(65,115,"QUEUE OPERATIONS                      QUEUE STATUS");
	outtextxy(140,440,"Press the Key that is Highlighted or use Mouse.");
	setcolor(CYAN);
	line(65,125,190,125);
	line(368,125,464,125);

// CALL THE SHOW FUNCTION TO DRAW THE VARIOUS BUTTONS

	show();

// DRAW THE QUEUE

	drawq();

// DRAW THE POINTERS THAT IS FRONT AND REAR

	moveptrs(&rear,&front);

// SET THE LABEL M THAT WILL BE USED LATER FOR UNCONDITIONAL JUMP

	m:

// GO ON CHECKING WHETHER A KEY IS PRESSED OR NOT

	while (i==0)
	       {
	       if (kbhit())
	       {
	       ch=getche();

	       // CHECK IF THE KEY PRESSED IS E OR e
	       switch(ch)
	       {
	       case 'e':
	       case 'E':

	       {
	       // CALL THE FUNCTION THAT WILL BE FOR EXIT
	       zoomin();
	       }
	       reset:
	       case 'R':
	       case 'r':
	       {
	       // CALL THE RESET QUEUE FUNCTION
	       hidequeueinfo();
	       // CALL THE PROGRESSBAR
	       slidebar(&rear,&front);
	       // AGAIN DRAW THE QUEUE
	       drawq();
	       restrictmouseptr(1,57,maxx-1,maxy-1);
	       goto m;
	       }
	       queueinfo:
	       case 'A' :
	       case 'a':
	       {
	       // CALL THE FUNCTION TO GIVE INFORMATION ABOUT QUEUE
	       hidequeueinfo();
	       showqueuesize();
	       goto m;
	       }
	       delet:
	       case 'D':
	       case 'd':
	       {
	       //  CALL THE DELETE QUEUE OPERATIONS
	       hidequeueinfo();
	       deleteq(&front);
	       // CHECK IF QUEUE IS EMPTY, IF SO PRINT THE MESSAGE
		       if(rear==-1 || front==5 ||rear<front)
			{
			// CLEAR THE INFO, THERE IN INFORMATION PART
			hidequeueinfo();
			// DISPLAY THE TEXT IN THE INFORMATION PART
			outtextxy(200,430,"Queue is empty, you can't delete");
			}
			else
			{
			front=front+1;
			moveptrs(&rear,&front);
			}
		goto m;
	       }
	       ins:
	       case 'I':
	       case 'i':
	       {
	       // HERE IS THE OPERATIONS FOR INSERTING AN ELEMENT
	       hidequeueinfo();
	       if(rear==4)
			{
			hidequeueinfo();
			outtextxy(200,430,"Queue is full, you can't insert");
			goto m;
			}

	       // SHOWS THE NUMBERS AND CANCEL BUTTON
	       shownumbers(20,430,60,470);
	       // CHECK FOR WHAT KEY PRESSED

	       n:

	       while(j==0)
	       {
		 if (kbhit())
		  {
		   ch1=getche();

			       if(front==-1)
			       {
			       front=front+1;
			       }
		   switch(ch1)
		   {
		   cancel:
		   case 'C':
		   case 'c':
		       {
		       hidequeueinfo();
		       restrictmouseptr(1,57,maxx-1,maxy-1);
		       goto m;
		       }
		   zero:
		   case '0':
		       {
			       insertq(&rear,'0');
			       rear=rear+1;
			       moveptrs(&rear,&front);
			       hidequeueinfo();
			       restrictmouseptr(1,57,maxx-1,maxy-1);
			       goto m;
		       }
		   one:
		   case '1':
		       {
			       insertq(&rear,'1');
			       rear=rear+1;
			       moveptrs(&rear,&front);
			       hidequeueinfo();
			       restrictmouseptr(1,57,maxx-1,maxy-1);
			       goto m;
		       }
		   two:
		   case '2':
		       {
			       insertq(&rear,'2');
			       rear=rear+1;
			       moveptrs(&rear,&front);
			       hidequeueinfo();
			       restrictmouseptr(1,57,maxx-1,maxy-1);
			       goto m;
		       }
		   three:
		  case '3':
		       {
			       insertq(&rear,'3');
			       rear=rear+1;
			       moveptrs(&rear,&front);
			       hidequeueinfo();
			       restrictmouseptr(1,57,maxx-1,maxy-1);
			       goto m;
		       }
		  four:
		   case '4':
		       {
			       insertq(&rear,'4');
			       rear=rear+1;
			       moveptrs(&rear,&front);
			       hidequeueinfo();
			       restrictmouseptr(1,57,maxx-1,maxy-1);
			       goto m;
		       }
		   five:
		   case '5':
		       {
			       insertq(&rear,'5');
			       rear=rear+1;
			       moveptrs(&rear,&front);
			       hidequeueinfo();
			       restrictmouseptr(1,57,maxx-1,maxy-1);
			       goto m;
		       }
		   six:
		   case '6':
		       {
			       insertq(&rear,'6');
			       rear=rear+1;
			       moveptrs(&rear,&front);
			       hidequeueinfo();
			       restrictmouseptr(1,57,maxx-1,maxy-1);
			       goto m;
		       }
		   seven:
		   case '7':
		       {
			       insertq(&rear,'7');
			       rear=rear+1;
			       moveptrs(&rear,&front);
			       hidequeueinfo();
			       restrictmouseptr(1,57,maxx-1,maxy-1);
			       goto m;
		       }
		  eight:
		   case '8':
		       {
			       insertq(&rear,'8');
			       rear=rear+1;
			       moveptrs(&rear,&front);
			       hidequeueinfo();
			       restrictmouseptr(1,57,maxx-1,maxy-1);
			       goto m;
		       }
		   nine:
		   case '9':
		       {
			       insertq(&rear,'9');
			       rear=rear+1;
			       moveptrs(&rear,&front);
			       hidequeueinfo();
			       restrictmouseptr(1,57,maxx-1,maxy-1);
			       goto m;
		       }
		   default :
				hidequeueinfo();
				outtextxy(200,430,"Invalid Key Pressed ! Press a valid key");
				delay(550);
				hidequeueinfo();
				shownumbers(20,430,60,470);
				goto n;
		   }
		}
		else
		{
		//write code here to press the 0-----9 and cancel
		       getmousepos(&button,&x,&y);
		       if((button & 1)==1)
		       {
			       if(front==-1)
			       {
			       front=front+1;
			       }
		       }
		       if( (x>500 && x<getmaxx()-10 && y>445 && y<470) && (button & 1)==1)
			{
			goto cancel;
			}
		       if( (x>20 && x<60 && y>430 && y<470) && (button & 1)==1)
			{
			goto zero;
			}
		       if( (x>60 && x<100 && y>430 && y<470) && (button & 1)==1)
			{
			goto one;
			}
		       if( (x>100 && x<140 && y>430 && y<470) && (button & 1)==1)
			{
			goto two;
			}
		       if( (x>140 && x<180 && y>430 && y<470) && (button & 1)==1)
			{
			goto three;
			}
		       if( (x>180 && x<220 && y>430 && y<470) && (button & 1)==1)
			{
			goto four;
			}
		       if( (x>220 && x<260 && y>430 && y<470) && (button & 1)==1)
			{
			goto five;
			}
		       if( (x>260 && x<300 && y>430 && y<470) && (button & 1)==1)
			{
			goto six;
			}
		       if( (x>300 && x<340 && y>430 && y<470) && (button & 1)==1)
			{
			goto seven;
			}
		       if( (x>340 && x<380 && y>430 && y<470) && (button & 1)==1)
			{
			goto eight;
			}
		       if( (x>380 && x<420 && y>430 && y<470) && (button & 1)==1)
			{
			goto nine;
			}
		}
	}
	}
	 default :
			hidequeueinfo();
			outtextxy(220,420,"Please Press a Valid Key");
			goto m;
	 }
	 }
	 // ELSE CONDITION FOR THE IF AFTER THE FIRST WHILE
	 else
	       {

		  getmousepos(&button,&x,&y);
		  if( (x>50 && x<200 && y<370 && y>350) && (button & 1)==1)
			{
			//exit button click
			zoomin();
			}
		  if( (x>50 && x<200 && y>150 && y<170) && (button & 1)==1)
			{
			//clicked the queueinfo button
			goto queueinfo;
			}
		  if( (x>50 && x<200 && y>200 && y<220) && (button & 1)==1)
			{
			//clicked the insert button
			goto ins;
			}

		  if( (x>50 && x<200 && y>250 && y<270) && (button & 1)==1)
			{
			//clicked the delete button
			delay(500);
			goto delet;
			}
		  if( (x>50 && x<200 && y>300 && y<320) && (button & 1)==1)
			{
			//clicked the reset button
			goto reset;
			}

		}


	}

getche();
}