CGR Microproject PDF
CGR Microproject PDF
CGR Microproject PDF
MICRO
MICRO-PROJECT
OF
COMPUTER GRAPHICS
“BOUNCING BALL”
Submitted In III- semester for Partial Fulfilment of Requirement for the
Diploma In Computer Engineering Of Maharashtra State Board Of Technical
Education
Submitted By
DURVA YERUNKAR (GROUP LEADER)
Guided By
Pournima Kamble.
(Lecturer in Computer Dept )
Sr.No. Title
1 Introduction.
Program code
3
Output
4
INTRODUCTION
3] #include<Graphics.h>
graphics.h functions can be used to draw different shapes, display text
in different fonts, change colors and many more. Using functions of
graphics.h in Turbo C compiler you can make graphics programs,
animations, projects, and games.
Other Functions
1. initgraph(): It is used to initialize graphic mode.
Syntax: initgraph(int driver, int mode, char path);
2. closegraph():The header file graphics.h contains closegraph()
function which closes the graphics mode, deallocates all memory
allocated by graphics system and restores the screen to the mode it
was in before you called initgraph.
Syntax:closegraph();
3. line():This command draws a line on screen.
Syntax:line(x1,y1,x2,y2);
4. circle():This command draws a circle on screen.
Syntax:circle(x,y,r);
C PROGRAM CODE FOR BOUNCING BALL
#include <stdio.h>
#include <conio.h>
#include <graphics.h>
void main()
{
int gd, gm, i, x;
detectgraph(&gd,&gm);
initgraph(&gd,&gm,"C:\\TC\\BGI");
x = 0;
for( i = 0; i<= 300 ; i++)
{
line(0,310,600,310)
circle (i,i,10);
delay(8);
cleardevice();
}
for(i = 300;i>=0;i--)
{
line(0,310,600,310)
x++;
circle(300+x,i,10);
delay(7);
cleardevice();
}
getch();
closegraph();
}
OUTPUT