Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

turbo c

  • 21-04-2009 08:14PM
    #1
    Registered Users, Registered Users 2 Posts: 382 ✭✭


    Hi all!

    Is it possible to use trigonometry functions in turbo c? ie. SIN COS TAN
    Just my program has equations using these and turbo c is failing to recognise them.


Comments

  • Registered Users, Registered Users 2 Posts: 2,157 ✭✭✭dazberry


    Yes are you #including <math.h> ?

    D.

    //edit: btw: they are lowercase, i.e. cos not COS etc.


  • Registered Users, Registered Users 2 Posts: 382 ✭✭DiarmaidGNR


    tried that already but still no joy


  • Registered Users, Registered Users 2 Posts: 291 ✭✭Biffo The Bare


    Heres an old example
    #include &#8220;stdio.h&#8221;
    #include &#8220;Math.h&#8221;
    #include &#8220;graphics.h&#8221;
    int main()
    {
    double i,cone,redian=22.0/(7.0*180.0);
    int gdriver = DETECT, gmode, errorcode;
    initgraph(&gdriver,&gmode,&#8221;f:\\tc\\bgi&#8221;);//Here is the path of the egevge file.
    //&#8212;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;
    }
    


  • Registered Users, Registered Users 2 Posts: 7,182 ✭✭✭Genghiz Cohen


    cosf & sinf maybe?


  • Registered Users, Registered Users 2 Posts: 981 ✭✭✭fasty


    why not open the math.h file and search for sin/cos/whatever?


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 382 ✭✭DiarmaidGNR


    I found the problem, - I had INT MAIN (VOID) at the start of the program insted of MAIN () .


    Thankyou all for the help


  • Registered Users, Registered Users 2 Posts: 291 ✭✭Biffo The Bare


    If you need error checking, its advisible to keep the int.


Advertisement