Flying balloon program in c graphics
Here you will learn to create a flying balloon program in c graphics programming. To make this animation program, We will use of some c graphics functions like line, setfillstyle, fillellipse, cleardevice() and for loop.
Program Code of Flying Balloon to the Sky
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | // Balloon flying from bottom to up #include <stdio.h> #include <conio.h> #include <stdlib.h> #include<dos.h> #include<graphics.h> int main() { int gd=DETECT,gm,i,ymax,ymin; initgraph(&gd, &gm, "C:\\Turboc3\\BGI"); for(ymax=getmaxy();ymax>=0;ymax--) { delay(50); cleardevice(); //Balloon 1 line(350,ymax,350,ymax-100); setfillstyle(11,CYAN); fillellipse(350,ymax-150,25,50); //Balloon 2 line(250,ymax-50,250,ymax-160); setfillstyle(11,RED); fillellipse(250,ymax-200,25,40); //Balloon 3 line(150,ymax,150,ymax-100); setfillstyle(11,YELLOW); fillellipse(150,ymax-150,25,50); } getch(); } |
Output