Quipex

Laba_3.6_XIII

Oct 11th, 2015
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. // laba_3.6_XIII.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <iomanip>
  7. #include <clocale>
  8. using namespace std;
  9.  
  10.  
  11. int main()
  12. {
  13.     setlocale(LC_CTYPE, "rus");
  14.     double s,y,p,a=-2,b=-0.1,h,x=0;
  15.     h=(b-a)/10;
  16.     int i,n=160;
  17.     x=a;
  18.     do
  19.     {
  20.         s=0;
  21.         for(i=1;i<=n;i++)
  22.         {
  23.             p=powf(-1,i)*powf(1+x,2*i)/i;
  24.             s+=p;
  25.         }
  26.         y=log(1/(2+2*x+x*x));
  27.         cout<<setw(15)<<s<<setw(15)<<y<<endl;
  28.         x+=h;
  29.     }
  30.     while(x<-0.1);
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment