Simply go through the Following coding or Download By clicking Download.Place the downloaded file in C:\TC\BGI
Download
CODE:
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <dos.h>
int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int midx, midy;
int radius = 46;
int startx;
/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, "C:\\turboc3\\bgi");
/* 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 */
}
midx = getmaxx() / 2;
midy = getmaxy() / 2;
setcolor(getmaxcolor());
rectangle(midx-50,midy-79,midx+50,midy+99);
/* draw the circle */
circle(midx, midy, radius);
/* clean up */
setfillstyle(SOLID_FILL,RED);
bar(midx-28,midy-20,midx-6,midy+2);
setfillstyle(SOLID_FILL,BLUE);
bar(midx-28,midy+28,midx-6,midy+8);
setfillstyle(SOLID_FILL,GREEN);
bar(midx+25,midy+2,midx+2,midy-20);
setfillstyle(SOLID_FILL,YELLOW);
bar(midx+25,midy+8,midx+2,midy+28);
line(368,325,270,325);
settextstyle(DEFAULT_FONT,HORIZ_DIR,1);
outtextxy(290,290,"Windows");
outtextxy(295,300,"Vista");
settextstyle(SMALL_FONT,HORIZ_DIR,1);
outtextxy(335,300,"Tm");
x:startx=midx-47;
while(startx<midx+46) {
setfillstyle(SOLID_FILL,GREEN);
bar(startx,midy+97,startx+10,midy+88);
delay(200);
startx+=12;
if (kbhit())
goto y;
}
setfillstyle(SOLID_FILL,BLACK);
bar(midx-47,midy+97,midx+48,midy+88);
delay(200);
goto x;
y:getch();
getch();
closegraph();
return 0;
}
Download
CODE:
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <dos.h>
int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int midx, midy;
int radius = 46;
int startx;
/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, "C:\\turboc3\\bgi");
/* 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 */
}
midx = getmaxx() / 2;
midy = getmaxy() / 2;
setcolor(getmaxcolor());
rectangle(midx-50,midy-79,midx+50,midy+99);
/* draw the circle */
circle(midx, midy, radius);
/* clean up */
setfillstyle(SOLID_FILL,RED);
bar(midx-28,midy-20,midx-6,midy+2);
setfillstyle(SOLID_FILL,BLUE);
bar(midx-28,midy+28,midx-6,midy+8);
setfillstyle(SOLID_FILL,GREEN);
bar(midx+25,midy+2,midx+2,midy-20);
setfillstyle(SOLID_FILL,YELLOW);
bar(midx+25,midy+8,midx+2,midy+28);
line(368,325,270,325);
settextstyle(DEFAULT_FONT,HORIZ_DIR,1);
outtextxy(290,290,"Windows");
outtextxy(295,300,"Vista");
settextstyle(SMALL_FONT,HORIZ_DIR,1);
outtextxy(335,300,"Tm");
x:startx=midx-47;
while(startx<midx+46) {
setfillstyle(SOLID_FILL,GREEN);
bar(startx,midy+97,startx+10,midy+88);
delay(200);
startx+=12;
if (kbhit())
goto y;
}
setfillstyle(SOLID_FILL,BLACK);
bar(midx-47,midy+97,midx+48,midy+88);
delay(200);
goto x;
y:getch();
getch();
closegraph();
return 0;
}
No comments:
Post a Comment