Exemple #1
0
void drawlives(void)
{
  int16_t l,n,g;
  char buf[10];
  if (gauntlet) {
    g=(int16_t)(cgtime/1193181l);
    sprintf(buf,"%3i:%02i",g/60,g%60);
    outtext(buf,124,0,3);
    return;
  }
  n=getlives(0)-1;
  outtext("     ",96,0,2);
  if (n>4) {
    drawlife(0,80,0);
    sprintf(buf,"X%i",n);
    outtext(buf,100,0,2);
  }
  else
    for (l=1;l<5;l++) {
      drawlife(n>0 ? 0 : 2,l*20+60,0);
      n--;
    }
  if (nplayers==2) {
    outtext("     ",164,0,2);
    n=getlives(1)-1;
    if (n>4) {
      sprintf(buf,"%iX",n);
      outtext(buf,220-strlen(buf)*12,0,2);
      drawlife(1,224,0);
    }
    else
      for (l=1;l<5;l++) {
        drawlife(n>0 ? 1 : 2,244-l*20,0);
        n--;
      }
  }
  if (diggers==2) {
    outtext("     ",164,0,1);
    n=getlives(1)-1;
    if (n>4) {
      sprintf(buf,"%iX",n);
      outtext(buf,220-strlen(buf)*12,0,1);
      drawlife(3,224,0);
    }
    else
      for (l=1;l<5;l++) {
        drawlife(n>0 ? 3 : 2,244-l*20,0);
        n--;
      }
  }
}
Exemple #2
0
main()
{
    int gd = DETECT, gm, height;
    char array[100];

    initgraph(&gd, &gm, "C:\\TC\\BGI");

    height = textheight("C programming");

    sprintf(array,"Textheight = %d",height);
    outtext(array);

    getch();
    closegraph();
    return 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;
}
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;
	}
	setviewport (50,50,270,208,clipon);	// x = 0-220  y = 0-158
	moveto(10,10);
	outtext ("1234567890");
	getch();
	closegraph();
	return 0;
}
Exemple #5
0
/*
 * Afiseaza pe ecran comenzile disponibile.
 */
void print_usage_text()
{
	set(4);
	setcolor(RED);
	outtext("Comenzi disponibile: ");
	outtextxy(3, 15, "-");
	outtextxy(6, 15, ">");
	setcolor(LIGHTBLUE);
	outtextxy(20, 15, "deplasare dreapta");
	setcolor(RED);
	outtextxy(3, 30, "<");
	outtextxy(6, 30, "-");
	setcolor(LIGHTBLUE);
	outtextxy(20, 30, "deplasare stanga");
	setcolor(RED);
	outtextxy(200, 12, "^");
	line(203, 15, 203, 21);
	setcolor(LIGHTBLUE);
	outtextxy(216, 15, "deplasare in sus");
	setcolor(RED);
	line(203, 30, 203, 36);
	putpixel(200, 36, RED);
	putpixel(201, 36, RED);
	putpixel(205, 36, RED);
	putpixel(206, 36, RED);
	putpixel(201, 37, RED);
	putpixel(202, 37, RED);
	putpixel(204, 37, RED);
	putpixel(205, 37, RED);
	putpixel(202, 38, RED);
	putpixel(203, 38, RED);
	putpixel(204, 38, RED);
	setcolor(LIGHTBLUE);
	outtextxy(216, 30, "deplasare in jos");
	setcolor(RED);
	outtextxy(400, 15, "+");
	setcolor(LIGHTBLUE);
	outtextxy(415, 15, "zoom in");
	setcolor(RED);
	outtextxy(400, 30, "-");
	setcolor(LIGHTBLUE);
	outtextxy(415, 30, "zoom out");
	setcolor(RED);
	outtextxy(520, 15, "ESC");
	setcolor(LIGHTBLUE);
	outtextxy(553, 15, "iesire");
}
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;
	}
	setviewport (50,10,90,300,clipoff);
	outtext ("1234567890");
	getch();
	clearviewport();	// Quedan pintados los caracteres 67890
	getch();
	closegraph();
	return 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;
	}
	moveto(20,20);
	outtext ("p  r  u  e  b  a");
	setviewport (100,100,400,400, 1 );
	getch();
	cleardevice();
	getch();
	closegraph();
	return 0;
}
Exemple #8
0
void draw_status_line(char *c)
  {
  static const word *font;
  static FC_TABLE color;
  static word backgr;
  static word ysmax=0,y;
  word ysize;
  CTL3D ctl;

  if (c==NULL)
     {
     backgr=curcolor;
     memcpy(&color,&charcolors,sizeof(charcolors));
     font=curfont;
     return;
     }

  schovej_mysku();
  curfont=font;
  ysize=text_height(c);
  if (ysmax>ysize) ysize=ysmax;else
     ysmax=ysize;

  highlight(&ctl,backgr);
  ctl.bsize=2;
  ctl.ctldef=0;
  curcolor=backgr;
  memcpy(&charcolors,&color,sizeof(charcolors));
  y=SCR_WIDTH_Y-ysize-3;
  desktop_y_size=y-3;
  bar(0,y,SCR_WIDTH_X-1,SCR_WIDTH_Y-1);
  draw_border(2,y,SCR_WIDTH_X-5,ysize,&ctl);
  while (text_width(c)>SCR_WIDTH_X)
     {
     char *p;

     p=strchr(c,'\0');
     *(--p)='\0';
     if (p==c) break;
     }
  position(5,y);outtext(c);
  ukaz_mysku();
  showview(0,y-2,SCR_WIDTH_X-1,ysize+5);
  }
Exemple #9
0
void button_draw2(int x1,int y1,int x2,int y2,OBJREC *o)
  {
  CTL3D x;
  char w;

  bar(x1,y1,x2,y2);
  highlight(&x,o->color);
  w=*(char *)o->data;
  x.bsize=1;
  x.ctldef=(w<<1)+w;
  draw_border(x1+1,y1+1,x2-x1-2,y2-y1-2,&x);
  if (!w)
  {
  curcolor=x.light;hor_line(x1,y1,x2);hor_line(x1,y1+1,x2);
  curcolor=x.shadow;hor_line(x1,y2,x2);hor_line(x1,y2-1,x2);
  }
  set_aligned_position(((x1+x2)>>1)+(w<<1),((y1+y2)>>1)+(w<<1),1,1,(char *)o->userptr);
  outtext((char *)o->userptr);
  }
Exemple #10
0
void main(void)
{
   clrscr();
   int gdriver=DETECT,gmode;
   initgraph(&gdriver,&gmode,"c:\\tc\\bgi");
   int x=0,y=0,r=0,b=0,color=0,midx,midy,maxx,maxy;
   midx=getmaxx()/2;
   midy=getmaxy()/2;
   maxx=getmaxx();
   maxy=getmaxy();
    rectangle(0,0,maxx,maxy);
   do
   {

      delay(10);
      setcolor(color);
      setbkcolor(0);
      arc(midx,midy,999,r,40);
      arc(midx,midy,999,r,42);
      arc(midx,midy,999,r,44);
      arc(midx,midy,999,r,46);
      arc(midx,midy,999,r,48);
      arc(midx,midy,999,r,50);
      arc(midx,midy,999,r,52);
      arc(midx,midy,999,r,54);
      arc(midx,midy,999,r,56);
      arc(midx,midy,500,r,70);
      arc(midx,midy,500,r,72);
      arc(midx,midy,500,r,74);
      arc(midx,midy,500,r,76);
      arc(midx,midy,500,r,78);
      arc(midx,midy,500,r,80);
      moveto(midx-20,midy);
      outtext("WE thank");
      x++;
      y++;
      r++;
      color++;
   }
   while( !kbhit() );
   getch();
   closegraph();
}
Exemple #11
0
int main() {
	int unidad = 0,modo;
	char titulo [36],*nombre;

	initgraph (&unidad,&modo,"c:\\bc\\bgi");
	if (graphresult() != 0) {
		printf ("Error al tratar de pasar al modo grafico\n");
		getch();
		return 1;
	}
	nombre = getdrivername();
	strcpy (titulo,"Unidad Graficadora = ");
	strcat (titulo,nombre);
	outtext (titulo);
	getch();
	closegraph();
	printf ("Modo Texto");
	getch();
	return 0;
}
Exemple #12
0
void str_line_draw(int x1,int y1,int x2,int y2,OBJREC *o)
  {
  char c[200];
  char **s;
  int *d;


  d=(int *)o->data;
  bar(x1,y1,x2,y2);
  s=*(char ***)(o->userptr);
  if (*d<0 || *d>=str_count(s) || s[*d]==0) strcpy(c,"???");else strcpy(c,s[*d]);
  while (text_width(c)>(x2-x1))
     {
     char *t;

     t=strchr(c,'\0');
     *(--t)='\0';
     }
  position(x1,y1);
  outtext(c);
  }
Exemple #13
0
int main() {
	int unidad = 0,modo,i;
	char s[10];

	initgraph (&unidad,&modo,"c:\\bc\\bgi");
	if (graphresult() != 0) {
		cout << "Error al tratar de pasar al modo grafico\n";
		getch();
		return 1;
	}
	i = getgraphmode();
	itoa (i,s,10);
	char *titulo = new char [strlen ("Modo actual = ") + strlen (s) + 1];
	strcpy (titulo,"Modo actual = ");
	strcat (titulo,s);
	outtext (titulo);
	getch();
	delete titulo;
	closegraph();
	return 0;
}
Exemple #14
0
void radio_butts_draw(int x1,int y1,int x2,int y2,OBJREC *o)
  {
  int step,size,sizpul,i,cr;
  long *params;
  char *texts;
  CTL3D ctl;

  cr=curcolor;
  highlight(&ctl,curcolor);
  params=(long *)o->userptr;
  if (*params) bar(x1,y1,x2,y2);
  step=(y2-y1)/(*(params+1));
  size=(step*9)/10;
  sizpul=size>>1;

  texts=(char *)(params+2);
  for (i=0;i<*(params+1);i++,y1+=step)
     {
     int j;
     curcolor=ctl.shadow;
     line(x1+sizpul,y1,x1,y1+sizpul);
     line(x1,y1+sizpul,x1+sizpul,y1+size-1);
     curcolor=ctl.light;
     line(x1+sizpul+1,y1,x1+size,y1+sizpul);
     line(x1+size,y1+sizpul,x1+sizpul+1,y1+size-1);
     if (*(long *)o->data==i) curcolor=0;else curcolor=cr;
     for (j=0;j<3;j++)
        {
        hor_line(x1+sizpul-j,y1+sizpul-2+j,x1+sizpul+j);
        hor_line(x1+sizpul-j,y1+sizpul+2-j,x1+sizpul+j);
        }
     if (*params)
        {
        set_aligned_position(x1+size+5,y1+sizpul,0,1,texts);
        outtext(texts);
        texts=strchr(texts,'\0')+1;
        }

     }
  }
  void data2(int a,int b)
  {
  setcolor(4);
       settextstyle(1,0,1);
       outtextxy(a,b,"visit us at");
       outtextxy(a,b+20,"");
       outtextxy(a,b+40,"www.profitzsoftwares.com ");
       outtextxy(a,b+60,"");
       outtextxy(a,b+80,"Or email us at");
       outtextxy(a,b+100,"");
       outtextxy(a,b+120,"*****@*****.**");
       outtextxy(a,b+140,"");
       outtextxy(a,b+160,"Happy Computing     ");
       outtextxy(a,b+180,"Get your licence soon..");

       moveto(a,b+240);
       setcolor(11);
       outtext("Thank you......");
       restore_previous_settings( );


}
Exemple #16
0
void testpause(void)
{
  int i;
  if (pausef) {
    soundpause();
    sett2val(40);
    setsoundt2();
    cleartopline();
    outtext(ddap, "PRESS ANY KEY",80,0,1);
    getkey(true);
    cleartopline();
    drawscores(ddap);
    for (i=0;i<diggers;i++)
      addscore(ddap, i,0);
    drawlives(ddap);
    if (!synchvid)
      curtime=gethrt();
    pausef=false;
  }
  else
    soundpauseoff();
}
int main() {
	initgraph(640,480);
	
	char s[101];
	inputbox_getline("Input Box", "Input a string", s, 100);
	outtextxy(10,10,s);
	int x = getInteger();
	xyprintf(10,30,"This is an integer: %d",x);
	double y = getDouble();
	xyprintf(10,50,"This is a double: %f",y);
	getString(s, 100);
	outtextrect(10, 80, 100, 60, s);
	char c = getChar("Input a character");
	outtext(c);
	int  coords[4];
	int *pc = getCoords(coords, 2);
	line(pc[0], pc[1], pc[2], pc[3]);
	
	ege::getch();
	closegraph();  
	
	return 0;
}
Exemple #18
0
void input_line_draw(int x1,int y1, int x2, int y2, OBJREC *o)
  {
  char d[2]=" \0";
  int x;
  char *c;
  int len;
  int shift;

  bar(x1,y1,x2,y2);
  position(x1,y1);
  c=(char *)o->data;
  if (!*c) return;
  len=strlen(c);
  shift=*((int *)o->userptr+1);
  if (shift>=len) shift=0;
  c+=shift;
  d[0]=*c++;x=x1+text_width(d);
  while (x<x2)
     {
     outtext(d);
     if (!*c) break;
     d[0]=*c++;x=writeposx+text_width(d);
     }
  }
Exemple #19
0
void endofgame(void)
{
  Sint4 i;
  bool initflag=FALSE;
  for (i=0;i<diggers;i++)
    addscore(i,0);
  if (playing || !drfvalid)
    return;
  if (gauntlet) {
    cleartopline();
    outtext("TIME UP",120,0,3);
    for (i=0;i<50 && !escape;i++)
      newframe();
    outtext("       ",120,0,3);
  }
  for (i=curplayer;i<curplayer+diggers;i++) {
    scoret=scdat[i].score;
    if (scoret>scorehigh[11]) {
      gclear();
      drawscores();
      strcpy(pldispbuf,"PLAYER ");
      if (i==0)
        strcat(pldispbuf,"1");
      else
        strcat(pldispbuf,"2");
      outtext(pldispbuf,108,0,2);
      outtext(" NEW HIGH SCORE ",64,40,2);
      getinitials();
      shufflehigh();
      savescores();
      initflag=TRUE;
    }
  }
  if (!initflag && !gauntlet) {
    cleartopline();
    outtext("GAME OVER",104,0,3);
    for (i=0;i<50 && !escape;i++)
      newframe();
    outtext("         ",104,0,3);
    setretr(TRUE);
  }
}
Exemple #20
0
	~textoAmpliar() {
		outtext ("TA ");
	}
Exemple #21
0
	~textoColor() {
		outtext("tc ");
		outtext (s () );
		outtext (" ");
	}
Exemple #22
0
void TEXTO::escribir() { outtext(cadena);  }
Exemple #23
0
	~TEXTO() {
		outtext (cadena);
		outtext (" ");
		delete cadena;
	}
Exemple #24
0
void write_book(int page)
  {
  int i = 0,y = 0,z,zz,ps,pg;
  char *c;
  char space[] =" ";

  pg = page;
  if (all_text == NULL) return;
  set_font(H_FKNIHA,NOSHADOW(0));
  relpos = XLEFT;
  zz = str_count(all_text);
  if (--page)
  for(i = 0;i<zz && page;i++)
     {
     c = all_text[i];
     if (c != NULL && c[0] == 27 && c[1] == END_PAGE) page--;
     }
  if (page) return;
  for(ps = 0;ps<2;ps++)
     {
  position(relpos,YLEFT+y);
  do
     {
     if (i>zz) break;
     c = all_text[i];
     if (c == NULL) break;
     if (c[0] == 27 && c[1] == END_PAGE) break;
     while (*c)
        {
        z = 0;
        if (*c == 27)
           {
           c++;
           switch (*c++)
              {
              case SPACE:
                          rel_position_x(read_num(c,&z));
                          c += z;
                          break;
              case END_LINE:
                          y += read_num(c,&z);
                          position(relpos,YLEFT+y);
                          c += z;
                          break;
              case PICTURE:
                          c = displ_picture(c);
                          break;
              }
           }
        else
           {
           space[0] = *c++;
           outtext(space);
           }
        }
     i++;
     }
  while (1);
  i++;y = 0;
  relpos = XRIGHT;
  if (ps == 0)
     {
     char s[20];
     sprintf(s,texty[135],pg);
     set_aligned_position(XLEFT,YLEFT+YMAX,0,0,s);
     outtext(s);
     }
  if (ps == 1)
     {
     char s[20];
     sprintf(s,texty[136],pg+1);
     set_aligned_position(XRIGHT+XMAX,YLEFT+YMAX,2,0,s);
     outtext(s);
     }
     }
  }
Exemple #25
0
void label(char *s) {
    gr_mode();
    moveto(g_round(screen_x_coord), g_round(screen_y_coord));
    outtext(s);
}
Exemple #26
0
void interpret()
{
	while (in[0])
		if (in[0] == '[') {
			char *argv[10];
			char *at;
			int argc = 0;
			int c;
			/* Parse command and arguments */
			++in;

		      loop:
			at = in;
			while (*in != ' ' && *in != 0 && *in != ']')
				++in;
			c = *in;
			*in = 0;
			if (*at == '[' && c == ']') {
				struct saved *cmd = get(at + 1);
				if (cmd && cmd->text)
					argv[argc++] = strdup(cmd->text);
				else
					argv[argc++] = strdup(at);
			} else if (at != in)
				argv[argc++] = strdup(at);
			*in = c;
			if (*at == '[' && c == ']')
				++in;
			while (*in == ' ')
				++in;
			if (*in != 0 && *in != ']')
				goto loop;
			if (*in == 0)
				error(line, "Missing ]");
			else
				++in;
			if (argc == 0)
				error(line, "Empty command");
			else {
				struct saved *cmd = get(argv[0]);
				if (!cmd)
					error(line, "Unknown command"),
					    error(line, argv[0]);
				else if (cmd->nargs > argc - 1)
					error(line,
					      "Incorrect no. of args");
				else {
					int x;
					push(argc, argv);
					for (x = 0; x != cmd->nargs; ++x)
						set(top, cmd->args[x],
						    strdup(argv[x + 1]), 0,
						    0, 0);
					if (cmd->func)
						cmd->func();
					else {
						char *cur = in;
						in = cmd->text;
						interpret();
						in = cur;
					}
					for (x = 0; x != argc; ++x)
						free(argv[x]);
					pop();
				}
			}
		} else if (*in == '\n') {
			++in;
			outtext();
		} else {
			char *at = in;
			int c;
			/* Generate text */
			while (*in != 0 && *in != '[' && *in != '\n')
				++in;
			c = *in;
			*in = 0;
			gentext(at);
			*in = c;
		}
}
void drawX( void )
{
	line( 0, 460, 46, 460 );
	line( 0, 460, 0, 455 );
	moveto( 0, 465 );
	outtext( "0" );

	line( 46, 460, 92, 460 );
	line( 46, 460, 46, 455 );
	moveto( 46, 465 );
	outtext( "1" );

	line( 92, 460, 138, 460 );
	line( 92, 460, 92, 455 );
	moveto( 92, 465 );
	outtext( "2" );

	line( 138, 460, 184, 460 );
	line( 138, 460, 138, 455 );
	moveto( 138, 465 );
	outtext( "3" );

	line( 184, 460, 230, 460 );
	line( 184, 460, 184, 455 );
	moveto( 184, 465 );
	outtext( "4" );

	line( 230, 460, 276, 460 );
	line( 230, 460, 230, 455 );
	moveto( 230, 465 );
	outtext( "5" );

	line( 276, 460, 322, 460 );
	line( 276, 460, 276, 455 );
	moveto( 276, 465 );
	outtext( "6" );

	line( 322, 460, 368, 460 );
	line( 322, 460, 322, 455 );
	moveto( 322, 465 );
	outtext( "7" );

	line( 368, 460, 414, 460 );
	line( 368, 460, 368, 455 );
	moveto( 368, 465 );
	outtext( "8" );

	line( 414, 460, 460, 460 );
	line( 414, 460, 414, 455 );
	moveto( 414, 465 );
	outtext( "9" );

	line( 460, 460, 460, 460 );
	line( 460, 460, 460, 455 );
	moveto( 460, 465 );
	outtext( "10" );
}
void boxx(int& a,int x1,int y1)
{
 int size=20;
   int col1=11;
   int col2=0;
   int col3=7;
get_current_settings( );
  char s[40]={NULL};
	  int x_1=x1,y_1=y1,x_2=x1+(size*10),y_2=y1+10;
	  int count_=0;
	    setfillstyle(1,8);
	 bar(x_1,y_1,x_2,y_2);

       setcolor(col3);
	 rectangle((x_1-1),(y_1-1),(x_2+1),(y_2+1));

       setcolor(col2);
	 rectangle((x_1-2),(y_1-2),(x_2+2),(y_2+2));

	   int key_code=0;

	     char key=NULL;


	  do{


	     if(kbhit( ))
		{
		   key=getch( );

		   key_code=int(key);

		   if(key_code==0)
		      getch( );
		}

	     if(key_code==13)
	     {

		break;
	     }
	      else if(key_code==27)
	     {
		br_flag=1;
		break;
	     }
	     else if(key_code==8 && count_>0)
		{
		   setfillstyle(1,8);
		     bar(x_1,y_1,x_2,y_2);

		   count_--;

		   s[count_]=NULL;
		   count_--;
		   key=NULL;
		}
	  else
	  {
	  char* d=NULL;
	  *d=(char)key;
	  strcat(s,d);
	  }
	      if(count_<3)
	      {
	       setfillstyle(1,8);
	       bar(x_1,y_1,x_2,y_2);
	      }

	     setcolor(col1);
	     settextstyle(0,0,1);
	       moveto((x_1+5),(y_1+4));
		 outtext(s);

	     int x=getx( );
	     int y=gety( );

	     while(!kbhit( ))
		{
		   settextstyle(0,0,1);
		     setcolor(15);
		       moveto((x+2),y);
			 outtext("_");

		   delay(250);

		     setcolor(col1);
		       moveto((x+2),y);
			 outtext("_");

		   delay(200);
	       }

	       count_++;

	       }while(count_<size-1);


	       a=atoi(s);
	       restore_previous_settings( );

}
Exemple #29
0
void plprint(const char* s)
{
#if DOS
	extern int newstyle;
	extern unsigned text_style, text_size, text_orient;
#endif
	char buf[128];

	if (text && s[strlen(s) - 1] == '\n') {
		IGNORE(strcpy(buf, s));
		s = buf;
		buf[strlen(s)-1] = '\0';
	}

	if (console && text) {
#if	DOS
		if (egagrph == 2) {
			if (newstyle) {
				settextstyle(text_style,text_orient,text_size);
				newstyle = 0;
			}
			outtext(s);
		}else{
			IGNORE(fprintf(cdev, "%s", s));
		}
#else
#if SUNCORE
		hoc_pl_sunplot(s);
#else
#if NRNOC_X11
		x11_put_text(s);
#else
#if NeXTstep
		if (graphdev == NX) 
			NeXT_put_text(s);
#else

		IGNORE(fprintf(cdev, "%s", s));
		IGNORE(fflush(cdev));
#endif
#endif
#endif
#endif

	} else if (!text) {
#if GRX
		if (egagrph) {
			hoc_outtext(s);
		}else
#endif
		{
			IGNORE(fprintf(stdout, "%s", s));
		}
	}
	if (hardplot && hpdev && text && strlen(s)) {
		hard_text_preamble();
		IGNORE(fprintf(hpdev, "%s", s));
		IGNORE(fflush(hpdev));
	}
	if (text && s == buf) {
		plt(1, xlast, ylast-20);
		plt(-2, 0.,0.);
	}
}
 void passboxx(char ast[],int x=50,int y=50,int size=20,int col1=11,int col2=0,int col3=7)
       {
       get_current_settings( );
  char s[40]={NULL};
  char p[40]={NULL};



	  int x_1=x,y_1=y,x_2=x+(size*10),y_2=y+10;
	  int count_=0;

	    setfillstyle(1,8);
	 bar(x_1,y_1,x_2,y_2);

       setcolor(col3);
	 rectangle((x_1-1),(y_1-1),(x_2+1),(y_2+1));

       setcolor(col2);
	 rectangle((x_1-2),(y_1-2),(x_2+2),(y_2+2));

	   int key_code=0;

	     char key=NULL;


	  do{


	     if(kbhit( ))
		{
		   key=getch( );

		   key_code=int(key);

		   if(key_code==0)
		      getch( );
		}

	     if(key_code==13)
	     {

		break;
	     }
	      else if(key_code==27)
	     {
		br_flag=1;
		break;
	     }
	     else if(key_code==8 && count_>0)
		{
		   setfillstyle(1,8);
		     bar(x_1,y_1,x_2,y_2);

		   count_--;

		   s[count_]=NULL;
		   p[count_]=NULL;
		   count_--;

		}
	  else
	  {
	  char* d=NULL;
	  *d=(char)key;
	  strcat(s,d);


	 //if(count_!=0)
	   p[count_-1]='*';
	  cout<<count_;


	  }
	      if(count_<3)
	      {
	      setfillstyle(1,8);
	       bar(x_1,y_1,x_2,y_2);
	      }

	     setcolor(col1);
	     settextstyle(0,0,1);
	       moveto((x_1+5),(y_1+4));

	       setfillstyle(1,8);
	       bar(x_1,y_1,x_2,y_2);

		 outtext(p);

	     int x=getx( );
	     int y=gety( );

	     while(!kbhit( ))
		{
		   settextstyle(0,0,1);
		     setcolor(15);
		       moveto((x+2),y);
			 outtext("_");

		   delay(250);

		     setcolor(col1);
		       moveto((x+2),y);
			 outtext("_");

		   delay(200);
	       }

	       count_++;

	       }while(count_<size-1);

strcpy(ast,s);
outtextxy(400,400,ast);
getch();
restore_previous_settings( );

       }