Advertisement
kirya_shkolnik

Вася, я еблан, не тот вариант блять

Oct 11th, 2020
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.13 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. double f(double x, double y) {
  7.     return ((1 - tan(x * pow(y, 2))) / pow(x, 1.0 / 3.0)) + 4 * sqrt(pow(x, 2) - 0.1);
  8. }
  9.  
  10. int main()
  11. {
  12.     double x, y;
  13.     int int_up, int_down;
  14.     cout << "Input variable \n x = ";
  15.     cin >> x;
  16.     cout << " y = ";
  17.     cin >> y;
  18.     int_up = ceil(f(x, y));
  19.     int_down = floor(f(x, y));
  20.     cout << "Result: " << f(x, y) << endl
  21.     cout    << "Rounding up int Result (int_down): " << int_up << endl;
  22.     cout    << "Round down int Result (int_down): " << int_down << endl;
  23.     cout    << "Explicit conversion Result (int)f(x,y): " << (int)f(x, y) << endl;
  24.     cout    << "Explicit conversion Result int (f(x,y)): " << int(f(x, y)) << endl;
  25.     cout    << "Recommended Explicit conversion result: " << static_cast<int>(f(x, y)) << endl;
  26.     cout << "Prefix int Result ++int_up: " << ++int_up << endl;
  27.     cout    << "Postfix int Result int_down++: " << int_down++ << endl; // Отдельные cout для демонстрации prefix и postfix
  28.     cout << "int_up after increment: " << int_up << endl;
  29.     cout    << "int_down after increment: " << int_down << endl;
  30.     system("PAUSE");
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement