Sunday , December 11 2016
Home / Animation / c program for Snooker Animation in C language

c program for Snooker Animation in C language


This is a computer graphics c program showing a little animation of Snooker Game.
If you want to use this program correctly you have to set your initgraph directory which is in my case is “c:\\tc\\bgi”. So find your directory and replace it with my directory.

#include
void main()
{
int gd=DETECT, gm;
int t1,t2,t3,t4,t5,t6,temp1,temp2;
float i,j=0;
initgraph(&gd,&gm,”c:\\tc\\bgi”);
setcolor(2);
t1=50;t2=50;t3=400;t4=250;
t5=60,t6=100;

for(i=0;i<8;i++)
{
rectangle(t1-i,t2-i,t3+i,t4+i);
circle(t1+8,t2+8,i+8);
circle(t1+8,t4-8,i+8);
circle(t3-8,t2+8,i+8);
circle(t3-8,t4-8,i+8);
}
j=t6;
i=t5;
delay(1000);
while(i<392)
{
setfillstyle(SOLID_FILL,BLACK);
setcolor(BLACK);
fillellipse(temp1,temp2,7,7);
i++;
if(i<203)
j++;
setfillstyle(SOLID_FILL,WHITE);
setcolor(MAGENTA);
fillellipse(i,j,7,7);
temp1=i;temp2=j;
delay(3);
}
for(i=0;i<8;i++)
{
circle(t3-8,t4-8,i+8);
}
getch();
}

OUTPUT

Tags: Computer Graphics program in C, c program for Snooker, Animation
Also See:   C Program for Binary Search Tree (BST)

Check Also

Hide Mouse Pointer C Program

How to Hide a Mouse Pointer Program in C : This program will show and hide ...

Leave a Reply

Your email address will not be published. Required fields are marked *

Preventing spam * Time limit is exhausted. Please reload the CAPTCHA.