Professional Documents
Culture Documents
United Institute of Management: Program On:animation Like Home & Raining
United Institute of Management: Program On:animation Like Home & Raining
Loop 700
times Draw Window
Generate
Raindrops
End
Header file
• Stdio.h
The header file stdio. h allows us to conduct input and output operations
in C. Printf() and scanf() are functions that are used to display output
and receive user input, respectively.
• Conio. h
Conio. h full form stands for “Console Input & Output”. conio. h in C
programming is a header file that provides the function of console input
and output.
Cont……
Header file
• Graphics. h
The graphics. h header file provides access to a simple graphics
library that makes it possible to draw lines, rectangles, ovals, arcs,
polygons, images, and strings on a graphical window.
• Stdlib. h
Stdlib. h stands for Standard Library. It has information related to
input/output functions. It has information related to memory
allocation/free functions.
Function
• lnitgraph()
Initializes the graphics system by loading a graphics driver
from disk and putting the system into graphics mode.
• Line()
Line is a library function of graphics. h in c programming
language which is used to draw a line from two coordinates.
Function
• Circle()
The header file graphics. h contains circle() function which
draws a circle with center at (x, y) and given radius.
• Getmaxx()
Getmaxx returns the maximum (screen-relative) x value for the
current graphics driver and mode.
Function
• Outtextxy()
Outtextxy displays a text string in the viewport at the given position (x,
y), using the current justification settings and the current font, direction,
and size.
• Random()
The random() function is a library function that generates the random
number in the range
Function
• Delay()
Delay function is used to suspend execution of a program for a
particular time.
• Cleardevice()
Cleardevice erases the entire graphics screen and moves the CP (current
position).
• Closegraph()
Closegraph function which closes the graphics mode.
Coding
#include<stdio.h>
#include<conio.h> Library
#include<graphics.h>
#include<stdlib.h>
void main()
{
int gd=DETECT,gm,x,y,j,i;
initgraph(&gd,&gm,"BGI");
Cont……
Coding
//Land
Land
line(0,300,1400,300);//9
//Gate
line(70,220,70,300);//10
line(130,220,130,300);//11 Gate
line(70,220,130,220);//12 12 15
//window 10 11 14 13
16
line(350,270,350,230);//13
9
line(250,270,250,230);//14
Window
line(250,230,350,230);//15
line(250,270,350,270);//26
Cont……
Coding
//moon Moon
circle(500,100,40);/17
//cloud Cloud
circle(100,1,30);//18
circle(40,1,50); 18
circle(160,5,20);
circle(220,1,40); 17
circle(280,0,20);
circle(350,10,40);
circle(410,1,20);
circle(600,1,50);
circle(530,1,20); Cont……
Coding
//rain 19 Rain
x= getmaxx(); //Maximum x Coordinate
y= getmaxy(); //Maximum y Coordinate
for(j=0;j<100; j++)
{
outtextxy(random(x),random(y),"|");
}
19
delay(5);
cleardevice();
}
getch();
closegraph();
}
Output
Thank You