Saturday, 24 February 2018

Plane C Graphics


Plane C Graphics





/*==============================
      Girfa Student Help
      Program :Plane C Graphics
      More Program :http://girfahelp.blogspot.in/p/graphics-c-language.html
================================*/
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <dos.h>
void drawplane(int);
int main(void)
{
   /* request auto detection */
   int gdriver = DETECT, gmode, error
code;
   int i,k;

   /* initialize graphics and local variables */
   initgraph(&gdriver, &gmode, "");

   /* read result of initialization */
   errorcode = graphresult();
   /* an error occurred */
   if (errorcode != grOk)
   {
      printf("Graphics error: %s\n", grapherrormsg(errorcode));
      printf("Press any key to halt:");
      getch();
      exit(1);
   }
///***diagram***//
   for(i=1;i<getmaxcolor();i++)
   {

      setcolor(i);
      drawplane(i);
      outtextxy(25,25,"mayank khare");
      outtextxy(400,400,"//khare.mayank09@gmail.com//");
      outtextxy(300,205,"AIR");
      outtextxy(350,200,"INDIA");
      for(k=0;k<650;k++)
      {
            setcolor(random(15));
            outtextxy(random(k),random(175),".");
      }
      delay(500);
      cleardevice();
   }
   /* clean up */
   getch();
   closegraph();
   return 0;
}
void drawplane(int n)
{
      int i,j,k;
      int poly[30];
   line(145,220, 475,175);
   arc(470,205,20,90,30);
   ellipse(500,210, 270,95,15,15);
   line(200,260,265,250);
   line(350,240,500,225);
   line(350,240,200,375);
   line(200,375,175,380);
   line(175,380,270,270);
   line(270,270,270,260);
   line(270,260,260,240);
   line(260,240,340,230);
   line(340,230,350,240);
   line(340,230,195,375);
   /**********/
   line(200,260,100,250);
   line(100,250,100,230);
   line(100,230,110,220);
   /****/
   line(110,225,90,150);
   line(90,150,110,150);
   line(110,150,150,225);
   line(150,225,110,225);
   line(95,170,105,170);
   line(105,170,130,225);

   //********//
   line(105,245,60,275);
   line(60,275,75,275);
   line(75,275,150,245);
   line(150,245,105,245);
   line(115,245,65,275);
   for(i=0,j=200,k=235;i<12;i++)
   {
      setcolor(n);
      rectangle(j,k,j+10,k+5);
      j=j+20;
      if(j>200)
            k=k-3;
   }
   setcolor(n);
   rectangle(400,205,410,230);
   poly[0]=487;
   poly[1]=180;
   poly[2]=470;
   poly[3]=180;
   poly[4]=475;
   poly[5]=190;
   poly[6]=495;
   poly[7]=190;
      drawpoly(4,poly);
}


No comments:

Post a Comment