Okay so basically this is the code, although it probably has a lot of double I didn't know how to put it in a simpler form, I just have one question however,
Here's an example program using the <cmath> header, which contains trigonometric functions such as sin, cos and tan (or you can use the <math.h> header).
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#include <iostream>
#include <cmath>
int main() {
double degrees = 45.0;
constdouble pi = 3.1415926;
double result = ::sin(degrees * pi / 180.0);
std::cout << "The Sine of " << degrees << " degree(s) is " << result << "." << std::endl;
return 0;
}
The code seems to work fine. The results are correct.
I would remove the "stdafx.h" header. Also, I wouldn't include both <cmath> and <math.h>, just include one of them, but not both.
Additionally, your variables angle and radian (declared on lines 13 and 14) are unused. Your variable rad1 (declared on line 16) is set on line 23, but is also never used.
Thanks xismn! I appreciate all the help. I removed them but when I tried removing rad1 It showed me an error in the problem because there's this rad1 = (degree*PI / 180);. Unless there's another way of showing it, then I'd love it if you could tell me how.