DEEPAK ps(am107cp117) do this....try out

deepakps 0 Tallied Votes 166 Views Share

this is a small graphical program in c....which gives you a clear discription about what a graphics can do in c..(a simple one)

// author  :: DEEPAK Ps
// amrita university ,amritapuri\
// doing bsc CS now


#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
   /* request auto detection */
   int gdriver = DETECT, gmode, errorcode;
   int left, top, right, bottom,i;
//   char s[20]="Done By DEEPAK..";
   /* initialize graphics and local variables */
   initgraph(&gdriver, &gmode, "");

   /* read result of initialization */
   errorcode = graphresult();
   if (errorcode != grOk)  /* an error occurred */
   {
      printf("Graphics error: %s\n", grapherrormsg(errorcode));
      printf("Press any key to halt:");
      getch();
      exit(1); /* terminate with an error code */

   }
 setbkcolor(WHITE);

  setfillstyle(XHATCH_FILL,45);
  bar(200,350,360,375);                 //   ....stand

  setcolor(BROWN);
  line(200,350,360,350);
  line(200,351,360,351);
  line(200,352,360,352);

   setfillstyle(SOLID_FILL,RED);

   bar(220,200,225,350);
   bar(220,200,300,205);    //   ..tap...
   bar(300,200,305,215);
   bar(290,180,298,200);
				     // bucket...

   bar(255,350,252,230);
   bar(335,350,338,230);
setcolor(RED);

outtextxy(10,90,"press any key to get water from the pipe...!!!");

getch();
for(i=1;i<=140;i++)
   {    setfillstyle(INTERLEAVE_FILL,BLUE);
	bar(300,210+i,305,210+i);                 //...water fill
		delay(30);
   }
   for(i=1;i<=120;i++)
   {    setfillstyle(INTERLEAVE_FILL,BLUE);
	bar(256,351-i,334,351-i);
	delay(100);                                   // bucket fill...
   }

       //     setlinestyle

   setfillstyle(SOLID_FILL,0);
	bar(300,208,310,230);
    setcolor(RED);

    setcolor(GREEN);
    outtextxy(20,110,"Bucket is full...please take your bucket..");

setcolor(BLUE);
outtextxy(50,130,"MADE BY : DEEPAK.P.S") ;
setcolor(CYAN);
outtextxy(75,150,"BSC II YEAR");



   getch();
   closegraph();
   return 0;
}
kiran Shetty 0 Newbie Poster

i put this code and runned.. bt its showing me error msg:
Graphics Error:Device Driver File Not Found (EGAVGA.BGI)


plz.. let me knw wats cause of error..?? expecting ur mail to me
<snip email>

thanks..

Deepak_17 0 Newbie Poster

If you get "Graphics error : Device driver file not found <EGAVGA.BGI>" in TurboC,
you have to specify the BGI path
to the initgraph method.

For example the path "C:\TC\BGI"
and the initgraph method will be like this,

initgraph(&gdriver,&gmode,"C:\TC\BGI");

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.