# Conical Waterfall : Turbo C++

ββThe Three-dimensional Text program featured the ability to display text in various three-dimensional orientations. Here, we present you the **Conical Waterfall**. This program creates an animation containing several cones which are rendered systematically so that they constitute a pleasant waterfall structure.

The **Conical Waterfall** utilizes several functions from the BGI library to render the cones. If you need an introduction to the BGI library, read How to Create Graphical Applications using Turbo C++ 3.0 IDE (BGI library). To learn in detail about BGI library functions, read BGI Library Functions – Part 1, Part 2, Part 3 and Part 4.

**The following video illustrates this animation :**

### How does this program work?

The Conical Waterfall generates several stacks of circles. These circles keep growing in size, until they’ve reached the maximum size. The collection of these circles appears like a growing cone. After one cone has been created, another starts appearing from the interior of the previous cone. The whole process continues till 5 rows of 5 cones each have been generated. After this, the entire process continues until the user presses a key on the keyboard.

### The Rendering Module

The module which performs the task of drawing the cones in this program is Cone_Animation. It draws all the cones and their sub-cones. The code for this module is displayed below :

/* Conical WaterFall by Manish Kumar */ void Cone_Animation() { float i; int r = 1,c=1; int X = 300, Y = 400; int l = 1; Message("Cone Animation"); while(!kbhit()) { if(l == 7) { r = 1; c=1; X = 300; Y = 400; l = 1; delay(300); clearviewport(); } if(r >=50) { r=1; Y += 50; l++; } if(c==14) c=1; Y -= 2; for(i = 0;i<=10;i+=0.003) { putpixel(r*sin(i)+X-200,r*cos(i)+Y,c); putpixel(r*sin(i)+X-100,r*cos(i)+Y,c); putpixel(r*sin(i)+X,r*cos(i)+Y,c); putpixel(r*sin(i)+X+100,r*cos(i)+Y,c); putpixel(r*sin(i)+X+200,r*cos(i)+Y,c); } r+=1; c++; } Pause(); } /* End of Program */

### Screenshots

Click here to download this program’s source code.

If you like this project, do let us know… π