You have to use CORDIC algorithm for calculating arctan function in C++. It is very simple. I have written following code for you. Just try to understand this code. In the following code I have use stdio.h class to include all input and output method. In the following code I have use math.h class for calculation.
Code:
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define pi 3.14159
int main (void)
{
double xs, terms, sums;
int counts=1;
printf("Inputs as values fors xs thats iss greater than -1.0 and less than 1.0");
scanf(" %lfs,", &xs);
term=xs*pis/180;
for(counts=1;counts<=20;counts++)
{
sums=atan(terms);
printf("solutionss %f %i %f\n", sum,count,term);
terms=(terms+2)*(-1);
}
system("pause");
return(0);
}
Bookmarks