C Program To Create A Lamp

/////////////////////////////////////////////////////////////////////////////
//     Lamp Project....                       //
/////////////////////////////////////////////////////////////////////////////

#include<constream.h>
#include<graphics.h>
void main(){
   int gm, gd =DETECT,scol,ecol,srow,erow;
   initgraph(&gd,&gm,"e:\\tc\\bgi");
   cleardevice();
   settextstyle(10,0,5);
  outtextxy(210,6,"LAMP");

    line(270,140,260,150);//blank
    line(280,140,260,160);//8th complete...
    line(290,140,260,170);//blank
    line(295,145,260,180);//7th complete
    line(295,155,260,190);//blank
    line(295,165,260,200);//6th complete
    line(295,175,260,210);//blank
    line(295,185,260,220);//5th complete
    line(295,195,260,230);//blank
    line(295,205,260,240);//4th complete
    line(295,215,260,250);//blank
    line(295,225,260,260);//3rd complete
    line(295,235,260,270);//blank
    line(295,245,260,280);//2nd complete
    line(295,255,270,280);//blank
    line(295,265,280,280);//1st complete

    int xradius=10,yradius=25;
    ellipse(278,139,0,180,xradius,yradius);

setcolor(4);

    for(int i=0;i<=10;i++){
    --xradius,--yradius;
    ellipse(278,139,0,180,xradius,yradius);
    line(278,120,278,138);

//    ellipse(278,140,0,180,9,24);
    }



/*  scol=269,srow=139,ecol=259,erow=149;
  for(i=0;i<=2;i++){
  line(scol,srow,ecol,erow);
  scol--,srow--,ecol--,erow--;}*/
  // line(295,265,280,280);
// Coding for filling the blank spaces
/////////////////////////////////////////////////////////////////////////////
//filling the first blank

  line(293,268,282,279);
  line(294,268,283,279);
  line(295,268,284,279);
  line(295,269,285,279);
  line(295,270,286,279);

  line(295,271,287,279);
  setcolor(10);
  line(295,272,288,279);
  line(295,273,289,279);
  line(295,274,290,279);
  line(295,275,291,279);
  line(295,276,292,279);
  line(295,277,293,279);
  line(295,278,294,279);
//filling the second blank
   scol=295,srow=246,ecol=261,erow=280;
   for(i=0;i<=8;i++){
   if(i==4){setcolor(RED);}
   line(scol,srow,ecol,erow);
   srow++;
   ecol++;
   }
//filling the third blank
scol=295,srow=226,ecol=261,erow=260;
   setcolor(10);
   for(i=0;i<=8;i++){
   if(i==4)
   {setcolor(RED);}
   line(scol,srow,ecol,erow);
   srow++;
   erow++;
   }
//filling the fourth blank

scol=295,srow=205,ecol=260,erow=240;
   setcolor(10);
   for(i=0;i<=8;i++){
   ++srow;
   ++erow;
   if(i==4)
   {setcolor(RED);}
   line(scol,srow,ecol,erow);
   }

//filling the fifth blank

scol=295,srow=185,ecol=260,erow=220;
   setcolor(10);
   for(i=0;i<=8;i++){
   ++srow;
   ++erow;
   if(i==4)
   {setcolor(RED);}
   line(scol,srow,ecol,erow);
   }
//filling the sixth blank
scol=295,srow=165,ecol=260,erow=200;
   setcolor(10);
   for(i=0;i<=8;i++){
   ++srow;
   ++erow;
   if(i==4)
   {setcolor(RED);}
   line(scol,srow,ecol,erow);
   }

//filling the seventh blank
scol=295,srow=145,ecol=260,erow=180;
   setcolor(10);
   for(i=0;i<=8;i++){
   ++srow;
   ++erow;
   if(i==4)
   {setcolor(RED);}
   line(scol,srow,ecol,erow);
   }
//filling the eight blank

scol=280,srow=140,ecol=260,erow=160;
   setcolor(10);
   for(i=0;i<=8;i++){
   scol++;
   erow++;
   if(i==4)
   {setcolor(RED);}
   line(scol,srow,ecol,erow);
   }
//filling the ninth blank
//line(269,140,260,149);
//line(268,140,260,148);
//line(270,140,260,150);//blank
setcolor(10);
scol=270,srow=140,ecol=260,erow=150;
   setcolor(10);
   for(i=0;i<=8;i++){
   scol--;
   erow--;
   if(i==4)
   {setcolor(RED);}
   line(scol,srow,ecol,erow);
   }









    setcolor(WHITE);
   rectangle(260,140,295,280);










   getch();

   getch();

}
Bhanu Namikaze

Bhanu Namikaze is an Ethical Hacker, Security Analyst, Blogger, Web Developer and a Mechanical Engineer. He Enjoys writing articles, Blogging, Debugging Errors and Capture the Flags. Enjoy Learning; There is Nothing Like Absolute Defeat - Try and try until you Succeed.

No comments:

Post a Comment