Sin and Cos. how do i use them in C++

Started by
15 comments, last by Barrager 20 years, 5 months ago
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.
-YoshiXGXCX ''99
Advertisement
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]
Life is but a Rollercoster, so sit back shut up and enjoy the ride.
h/sin60 = hip/sin90

hip="hipotenuse"
h = height

The Sin Law.
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)
-YoshiXGXCX ''99
ok roger that.. eldee threw me off by saying depreciated and not depricated lol...
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 hpolloni
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.


Whoops, read it wrong.
-YoshiXGXCX ''99

This topic is closed to new replies.

Advertisement