#include <iostream>
#include <cmath>
using namespace std;
int main ()
{
float x, xRad, answer;
cout<<"Enter the value of x in degrees:";
cin>>x;
cout<<endl;
xRad=(x*3.1416)/180;
answer=xRad-pow(xRad, 3)/6+pow(xRad, 5)/120-pow(xRad, 7)/5040;
cout<<"The value of sine "<<x<<" is approximately "<<answer<<endl;
return 0;
}
You can check it by comparing the values given by the program to those given by a calculator. What do you get?
It looks correct in that sin(x) = x - x^3/3! + x^5/5! - x^7/7! + ... and it appears your code matches that.