Advertisement
cacodemon665

Лаба 3 Вариант 1

Nov 7th, 2018
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include "pch.h" //для версий вижлы старше последних версий 2017 здесь должно быть #include "stdafx.h"
  2. #include <iostream>
  3. #include <math.h>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     double a = 0.1, b = 1;
  10.     int n = 160;
  11.  
  12.     double step = (b - a) / 10;
  13.  
  14.     cout << "Y(x)         S(x)" << endl;
  15.  
  16.     for (double x = a; x <= b; x += step)
  17.     {
  18.         cout << sin(x) << "  ";
  19.         double sum = 0, a = x;
  20.  
  21.         for (int i = 1; i < n; i++)
  22.         {
  23.             sum += a;
  24.             a *= -x * x / (2 * i * (2 * i + 1));
  25.         }
  26.  
  27.         cout << sum << endl;
  28.     }
  29.  
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement