include stdafx include math include iostream using namespace std doubl

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "stdafx.h"
#include "math.h"
#include <iostream>
using namespace std;
double f (double x, double e)
{ double xx=x*x;
double func=x;
double q =100.0;
int i=1;
while (abs(func-q)>=e)
{q=func;
i=i+2;
func=func+xx/i;
}
return func;
}
void main()
{ double x, e;
cin>>x;
cin>>e;
cout<<tan(x)<<' '<<f(x,e);
}