win32 native console application

Nov 21, 2012 at 2:53pm
i want ot insert trignomatric function in my calculator ..how to use trignomatric ratioes and get correct answar in c++ native win32 console application
plzz help me wd example
Nov 21, 2012 at 2:59pm
The basic trig functions are found in <cmath>. Remember that we work in radians rather than degrees.
Nov 21, 2012 at 3:03pm
how to exactly convert to radian?
Nov 21, 2012 at 3:28pm
Divide by (2*pi/360)
Nov 21, 2012 at 3:35pm
which value of pi i write?
Nov 21, 2012 at 3:47pm
What's your favourite value of pi?
Nov 22, 2012 at 2:54am
when i insert 22/7 then it replies wrong .it says that cos 90 is equal to 1..thts wrong
Last edited on Nov 22, 2012 at 2:54am
Nov 23, 2012 at 8:25pm
22/7 radians is not 90 degrees.
Last edited on Nov 23, 2012 at 10:59pm
Dec 4, 2012 at 2:27pm
i mean if i convrt degre to radian by putting value of pi as 22/7 then answars are wrong
Dec 4, 2012 at 2:46pm
One of these things is true:

1) The universe has changed and cos and sin have different answers now.
2) Your code is wrong.
3) Your code is giving you a correct answer but you don't understand what it's saying.

I'm going to guess 2, but it could be 3.
Last edited on Dec 4, 2012 at 2:47pm
Dec 4, 2012 at 4:59pm
closed account (z05DSL3A)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

int main ()
{

    cout << setprecision(20) << cos(90.0 * 2 * 3.14159265358979 / 360.0) << endl;
    cout << setiosflags(ios::fixed) << setprecision(20)<< cos(90.0 * 2 * 3.14159265358979 / 360.0) << endl;

    return 0;
}
Dec 4, 2012 at 7:37pm
22/7 is a poor substitute for PI. It's only used when you're doing all your calculations by hand.

acos(-1.0) should give you a good value for PI. This is because there are 2PI radians in a full circle. So a semi-circle has PI radians. cos(PI) is -1, so arc cos(-1) is PI. It's not obvious without a diagram of a unit circle.
http://pubs.opengroup.org/onlinepubs/007908799/xsh/acos.html
Last edited on Dec 4, 2012 at 7:37pm
Topic archived. No new replies allowed.