April 7, 2011

Rainbow Cone in C

We have started new graphics codes series.. Lots of awesome graphic code gonna come here..

Here is one awesome Rainbow Cone code in C. This program is build by using graphic.h header file. Graphic drivers, graphic mode which is present in BGI folder of TC i.e. C:\\tc\\bgi


Rainbow Cone in C*/
#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <graphics.h>
void main()
int dr,md,midx, midy, mx, my,i,j,k,x,y,x1,y1;
double pi,tpi,a,t;
dr = DETECT;

initgraph(&dr, &md, "c:\\tc\\bgi");
midx = getmaxx()/2; midy = getmaxy()/2;
pi = 3.14159;
tpi = pi * 2.0;

for (t = 0; t < 40 * 5; t += .1)
  x = midx+ (t * cos(t) * sin(t));
  y = midy+ (t * sin(t));


  if (kbhit()) break;



Note: Note: this program will run only on windows xp and previous versions of windows. Reason is windows newer versions are not compatible with turbo c++ 3.0 graphic header files.

Hope you will like this one, Post your comment and queries below... :)

Related Posts :



Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

Related Posts with Thumbnails