Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <cmath>
  4. #include <iomanip>
  5.  
  6. using namespace std;
  7.  
  8. ofstream out("Tabel.txt");
  9.  
  10. int main()
  11. {
  12.     double x, y;
  13.     double PI = atan(1) * 4;
  14.  
  15.     out << " X   ";
  16.  
  17.     for(x = -3; x <= 8; x += 1){
  18.         out << setw(11) << x;
  19.     }
  20.  
  21.     out << '\n' << "F(X)" << '\t';
  22.  
  23.     for(x = -3; x <= 8; x += 1){
  24.         if(x < 0){
  25.             y = (sqrt(pow(x, 2) + 1) - x) / (pow(x, 3) - 1);
  26.         }else if(x < PI){
  27.             y = 5 * pow (cos(x), 7) - 1 + (3 + sin(2 * x)) / (1 + pow(sin(x), 2));
  28.         }else{
  29.             y = cbrt((pow(x, 2) + sqrt(pow(x, 5) - 1)) / (2 * x + 3));
  30.         }
  31.  
  32.         out << setfill (' ') << setw (10) << setprecision(5) << y << ' ';
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement