Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //LABORATORY #3
- //TASK 1
- #include <stdio.h>
- void main()
- {
- unsigned a = 39;
- char b = 150;
- short c = 4;
- int e = 24;
- bool rez = (!a-- + -b-- | (!c-- > sizeof(float) ^ ++e));//Виконує обчислення логічної функції
- printf("Result of calculations: %d\n", rez); //Виводить результат обчислення логічної функції
- bool i1 = (!a-- + -b--); //По частинам (1 дужка)
- bool i2 = (!c-- > sizeof(float) ^ ++e); // 2 дужка
- bool i3 = i1 | i2; //Остання операція
- printf("Result of calculations by parts:\n\tFirst operation:%d\tSecond operation:%d\tAll together:%d\n", i1, i2, i3);
- }
- //TASK 2
- #include <math.h>
- #include <iostream>
- using namespace std;
- void main()
- {
- double x;
- cout << "Enter value of X: ";
- cin >> x;
- double xmod = (fabs(x));
- double y = log2(xmod);
- cout << "\ny = " << y<<endl;
- }
- //TASK 3
- #define _USE_MATH_DEFINES
- #include <math.h>
- #include <iostream>
- using namespace std;
- void main()
- {
- double x, y;
- cout << "enter x: ";
- cin >> x;
- y = log(sqrt(2)) + fabs(cos(3 * x)) + exp(x + M_E) - atan((x*x) / 5) + sqrt(3.25 + x*x*x);
- cout << "y = " << y << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement