Skip to content
September 26, 2007 / ranacse05

Fun with Turbo C


Here is a program which show sin,cos,tan graph . Just copy and past in .c or .cpp file and compile and see 🙂

/**********************************************
* Fun with C. /
* Sin,cos,tan grapth in Turbo C. /
* Aughtor:Raquibul Islam /
* Email:rana_cse_05@yahoo.com /
* http://ranacse05.blogspot.com /
* https://ranacse05.wordpress.com /
* http://www.ranacse05.tk /
***********************************************/

#include “stdio.h”
#include “Math.h”
#include “graphics.h”

int main()
{
double i,cone,redian=22.0/(7.0*180.0);

int gdriver = DETECT, gmode, errorcode;
initgraph(&gdriver,&gmode,”f:\\tc\\bgi”);//Here is the path of the egevge file.

//—2 lines for axais.
line(50,50,50,400);
line(50,220,550,220);

for(i=50.0,cone=0;i<550.0;i=i+.1,cone=cone+.1)
{
putpixel(i,220-((sin(cone*redian))*50),2); //for sine
putpixel(i,220-((cos(cone*redian))*50),3); //for cos
putpixel(i,220-((tan(cone*redian))*50),5); //for tan
delay(3);
}
delay(2000);
return 0;
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: