Skip to content

Instantly share code, notes, and snippets.

@ernado
Created September 19, 2012 18:28
Show Gist options
  • Save ernado/3751305 to your computer and use it in GitHub Desktop.
Save ernado/3751305 to your computer and use it in GitHub Desktop.
Работает! :))
#include <iostream>
#include "riostream.h"
#include <math.h>
#include <iomanip>
using namespace std;
int main()
{char c; double x, y, s, a; int n;
for (x=0; x<1; x=x+0.2)
{y=log((1+x)/(1-x));
n=1;
/*s=x;
do
{n++;
a=(pow(x,2*n+1))/(2*n+1);
s=s+a;}
while (a>=0.000001);
s=2*s;*/
a=pow(x,3)/3;
s=x+a;
do
{n++;
a=a*pow(x,2)*(2*n-1)/(2*n+1);
s=s+a;}
while (a>0.000001);
s=2*s;
cout<<setw(2)<<x<<setw(10)<<y<<setw(10)<<s<<setw(10)<<n<<endl;}
//cout<<"Ещё раз? (y/n)"<<endl;
//cin>>c;
//cout<<endl;
//}
//while (c!='n');
system("pause");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment