AddO1f

Lab3_1

Oct 11th, 2015
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include "iostream"
  3. #include "iomanip"
  4. #include "math.h"
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     double a,b,h,x,y,p;
  11.     int n,i;
  12.     cout <<"Enter a,b,n:"<< endl;
  13.     cin>>a>>b>>n;
  14.     h=(b-a)/10;
  15.     x=a;
  16.     do
  17.     {
  18.         p=x;
  19.         for (i=1;i<=n;i++);
  20.         {
  21.             p*=(-1)*pow(x,2)/((i+1)*(i+2));
  22.             p=x+p;
  23.         }
  24.         y=sin(x);
  25.         cout<<setw(15)<<p<<setw(15)<<y<<setw(15)<<endl;
  26.         x+=h;
  27.     }
  28.     while (x<=b);
  29.     cout<<endl;
  30.     system("pause");
  31.     return 0;
  32. }
Add Comment
Please, Sign In to add comment