GET KTU B.TECH RESULTS ON MAIL

Subscribe to our mailing list and get KTU results in your mail box. CLICK HERE

MAN KICKING A FOOTBALL INTO A GOAL POST - Computer Graphics Lab Programs in C Programming Language

Computer Graphics Lab Programs in C Programming Language - MAN KICKING A FOOTBALL INTO A GOAL POST


AIM
Write a C program to show the animation of a football goal.

ALGORITHM
Step 1: Start
Step 2: Draw the goal post and the man with a ball.
Step 3: Provide appropriate loop to show the motion of the ball so that it reaches the
goal post
Step 4: Stop.

PROGRAM
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void car(int x);
void main()
{
int gd=DETECT,gn;
int x,y,z,a;
char ch;
initgraph(&gd,&gn,"D:\\TC\\BGI");
y=10;
x=2;
while(!kbhit())
{
while(x<290)
{
cleardevice();
line(600,400,600,200);
line(600,200,540,180);
line(0,400,1000,400);
line(540,180,540,400);
//man
circle(280,340,10);
line(280,350,280,385);
line(280,360,270,365);
line(280,360,290,355);
line(280,385,270,400);
line(280,385,290,400);
//ball
a=390-y;
setfillstyle(SOLID_LINE,GREEN);
circle(300+x,a,10);
floodfill(300,390,WHITE);
z=300+x;
y=y+1;
x=x+5;
if(z>600)
{
a=400;
}
delay(50);
}

} }

OUTPUT
MAN KICKING A FOOTBALL INTO A GOAL POST  - Computer Graphics Lab Programs in C Programming Language
MAN KICKING A FOOTBALL INTO A GOAL POST

Previous
Next Post »