Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

turbo c

Options
  • 21-04-2009 8:14pm
    #1
    Registered Users 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 Posts: 2,150 ✭✭✭dazberry


    Yes are you #including <math.h> ?

    D.

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


  • Registered Users Posts: 382 ✭✭DiarmaidGNR


    tried that already but still no joy


  • Registered Users 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 Posts: 7,182 ✭✭✭Genghiz Cohen


    cosf & sinf maybe?


  • Registered Users Posts: 981 ✭✭✭fasty


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


  • Advertisement
  • Registered Users 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 Posts: 291 ✭✭Biffo The Bare


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


Advertisement