Write a program that calculates the value of sin(x) from the power series x - (x^3/3!) + (x^5/5!) - (x^7/7!) + ..... The user should be prompted for both the value of x and the number of terms to include in the calculation.
My code seems to work for most numbers but if I input n (number of terms) greater than 7, then it just goes to a really high number. Also, how would I change my code so that the numbers are exact, not integers. Any help would be greatly appreciated!
using namespace std;
int PowerSeries(int x,int n)
cout << " Please enter the value of x. " << endl;
cin >> x;
cout << " Please enter the number of terms. " << endl;
cin >> n;