I am trying to perform sin(pi*0.5), but I cant get it to work. Here is my code:
#include%26lt;iostream%26gt;
#include%26lt;math.h%26gt;
using namespace std;
const double PI = 4.0*atan(1.0)
int main()
{
x = sin( pi*0.5 );
cout %26lt;%26lt; x;
}
It will not give the correct answer. Any help?
How do you take the sin of a function in c++?
error 1 -- x should be declared like
double x;
error 2 -- there is a ; at the end of const double ...
error 3 -- the const is PI all caps.
It works on my machine.
imperial
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment