Blinking Lights Graphics In CPP # include # include # include # include void intro() { clrscr(); int gd=DETECT,gm,i=0; detectgraph(&gd,&gm); initgraph(&gd,&gm,"c:\tc\bgi"); rectangle(0,5,630,400); rectangle(10,15,620,390); settextstyle(1,0,1); outtextxy(245,238,"DESIGNER"); while(!kbhit()) { setcolor(i); settextstyle(2,0,0); outtextxy(32,170,"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *"); outtextxy(32,178,"* *"); outtextxy(32,186,"* *"); outtextxy(32,196,"* *"); outtextxy(32,205,"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *"); setfillstyle(XHATCH_FILL,i++); delay(200); floodfill(2,9,15); if(i>=15) i=0; } getch(); cleardevice(); closegraph(); } /*******************END OF INTRO.H********************************/ /* main file: blinky.h*/ # include # include # include # include # include # include # include # include int poly[8],toggle=1,z; void blink(int fuzzy[],int size,int lazy,int paint) { for(int i=0;i"; cin>>ch; switch(ch) { case 1: cout<<" choose type of blink rate: very slow/slow/fast/very fast(enter 1/2/3/4)--->"; cin>>ch; if(ch==1) lazy=1000; if(ch==2) lazy=600; if(ch==3) lazy=100; if(ch==4) lazy=10; break; case 2: cout<<" blink color: random or fixed color ?(enter 1/2)--->"; cin>>paint; break; case 3: cout<<"roughly estimate the no. of blinks per second(multiples of ten,max 50)--->"; cin>>size; break; case 4: lazy=100; paint=15; size=20; break; case 5: backend(); exit(0); } initgraph(&gd,&gm,""); for(int i=0;i<630;i+=30) { for(int j=0;j<470;j+=30) { delay(10); rectangle(i,j,i+30,j+30); } } int fuzzy[50],dummy=0; while(!kbhit()) { randomize(); for(i=0;i # include # include void backend() { int gd=DETECT,gm; detectgraph(&gd,&gm); initgraph(&gd,&gm,"c:\tc\bgi"); rectangle(0,5,630,400); rectangle(12,15,618,390); settextstyle(1,0,5); outtextxy(180,60,"THANK YOU"); settextstyle(1,0,3); outtextxy(160,128,"HOPE U LIKED IT !"); settextstyle(1,0,1); outtextxy(220,250,"HAVE A NICE DAY !"); int i=0; while(!kbhit()) { delay(200); setfillstyle(XHATCH_FILL,i++); floodfill(2,9,15); if(i>=15) i=0; } getch(); closegraph(); }
No comments: