Sin and Cos. how do i use them in C++
math.h isn''t part of the C++ standard is what the difference is. However, it is part of the C standard so I believe you can be guaranteed that the contents of math.h are the same throughout different implimentations.
ok so heres what i should do from what i got out of your posts
#include <cmath>
main ()
{
double I;// length of hypotenuse
double E;// equals the angle
double ans;
cin >> E;
ans=cos(E);
}
ok so what about the hypotenuse where does that come into play. the object of using sin and cos, is to figure out the hieght of a paralellagram by using only the measurements of it's angles and sides like this:
```````12
________________
\``````````````|`\```````````x`|`\```9
``\````````````|``\
```\___________|___\ a:60 degrees
how do i find x?
[edited by - barrager on November 18, 2003 11:16:38 AM]
[edited by - barrager on November 18, 2003 11:19:02 AM]
[edited by - barrager on November 18, 2003 11:20:29 AM]
#include <cmath>
main ()
{
double I;// length of hypotenuse
double E;// equals the angle
double ans;
cin >> E;
ans=cos(E);
}
ok so what about the hypotenuse where does that come into play. the object of using sin and cos, is to figure out the hieght of a paralellagram by using only the measurements of it's angles and sides like this:
```````12
________________
\``````````````|`\```````````x`|`\```9
``\````````````|``\
```\___________|___\ a:60 degrees
how do i find x?
[edited by - barrager on November 18, 2003 11:16:38 AM]
[edited by - barrager on November 18, 2003 11:19:02 AM]
[edited by - barrager on November 18, 2003 11:20:29 AM]
cos(a) = adj/hyp. You know the angle and the hypotenuse, so you need to solve for the adjacent side.
adj = hyp*cos(a), or using your numbers x = 9*cos(60).
However, because the computer uses radians in your program it should be:
x = 9*cos(Pi/3)
adj = hyp*cos(a), or using your numbers x = 9*cos(60).
However, because the computer uses radians in your program it should be:
x = 9*cos(Pi/3)
quote:Original post by YoshiN
cos(a) = adj/hyp. You know the angle and the hypotenuse, so you need to solve for the adjacent side.
adj = hyp*cos(a), or using your numbers x = 9*cos(60).
However, because the computer uses radians in your program it should be:
x = 9*cos(Pi/3)
actually it''s 9*sin60, he wants the height,so it''s the opposite side,not the adjacent.
quote:Original post by hpolloniquote:Original post by YoshiN
cos(a) = adj/hyp. You know the angle and the hypotenuse, so you need to solve for the adjacent side.
adj = hyp*cos(a), or using your numbers x = 9*cos(60).
However, because the computer uses radians in your program it should be:
x = 9*cos(Pi/3)
actually it''s 9*sin60, he wants the height,so it''s the opposite side,not the adjacent.
Whoops, read it wrong.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement