0

am trying to write a program which compute sin using an a equation instead of the function of sin in cmath libry.
"the equation is like this Tn = (Tn-2 *(-1) *x*x)/ n*(n-1)

#include<iostream>
#include<cmath>
using namespace std;

int main()
{
	
	int factorial(int);
	int n =1, i = 1;
	double sum, t, x;
	char choice;
	//r = x * (PI / 180)
	
	cout<<"Please enter an angle value => ";
	cin>>x;
	cout<<"Is the angle value in Degree or Radian?"<<endl;
	cout<<"Type D if its in degree "<<endl;
	cout<<"Type R if its in radian "<<endl;
	cin>>choice;
	
	
	
		
	if((choice == 'R') || (choice == 'r'))
		{
		do
		{
	 t = sum; i++; n++;
		sum = n-2*(-1) * pow(x,2)/ (n * (n-1));
	   
    }
		while(abs(sum>0.00001));
		cout<<"what"<<endl;
}
	    else 
	{
	cout<<"eror\n";
	}
		return 0;
}
2
Contributors
1
Reply
2
Views
10 Years
Discussion Span
Last Post by Ancient Dragon
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.