Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- double f(double x, double y) {
- return ((1 - tan(x * pow(y, 2))) / pow(x, 1.0 / 3.0)) + 4 * sqrt(pow(x, 2) - 0.1);
- }
- int main()
- {
- double x, y;
- int int_up, int_down;
- cout << "Input variable \n x = ";
- cin >> x;
- cout << " y = ";
- cin >> y;
- int_up = ceil(f(x, y));
- int_down = floor(f(x, y));
- cout << "Result: " << f(x, y) << endl
- cout << "Rounding up int Result (int_down): " << int_up << endl;
- cout << "Round down int Result (int_down): " << int_down << endl;
- cout << "Explicit conversion Result (int)f(x,y): " << (int)f(x, y) << endl;
- cout << "Explicit conversion Result int (f(x,y)): " << int(f(x, y)) << endl;
- cout << "Recommended Explicit conversion result: " << static_cast<int>(f(x, y)) << endl;
- cout << "Prefix int Result ++int_up: " << ++int_up << endl;
- cout << "Postfix int Result int_down++: " << int_down++ << endl; // Отдельные cout для демонстрации prefix и postfix
- cout << "int_up after increment: " << int_up << endl;
- cout << "int_down after increment: " << int_down << endl;
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement