Last active
October 2, 2017 18:09
-
-
Save BoberMod/5714c8b4766a2a5722a96e254d902e7f to your computer and use it in GitHub Desktop.
lab.methods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cmath> | |
double firstBlock(double x) | |
{ | |
double result = sqrt(abs(pow(x, 3) - 1)) - 7 * cos(cbrt(pow(x, 4) + 4)); | |
return result; | |
} | |
void secondBlock(double x, double y) | |
{ | |
int radius = 2; | |
//if (pow((x - 0), 2) + pow((y - 0), 2) < pow(radius, 2)) //есть ли точка в круге с центром 0;0 и радиусом radius | |
if (y <= 2 && y >= -2 && pow(x, 2) + pow(y, 2) <= pow(radius, 2)) | |
std::cout << "YES"; | |
else | |
std::cout << "NO"; | |
} | |
void thirdBlock() | |
{ | |
int a = 100; | |
double dB = 0.001; | |
float fB = 0.001; | |
std::cout << "A = " << a << "\nB = " << fB; | |
float floatResult = (pow(a + fB, 3) - pow(a, 3)) / (pow(fB, 3) + 3 * a * pow(fB, 2) + 3 * pow(a, 2) * fB); | |
double doubleResult = (pow(a + dB, 3) - pow(a, 3)) / (pow(dB, 3) + 3 * a * pow(dB, 2) + 3 * pow(a, 2) * dB); | |
std::cout << "\nFloat = " << floatResult; | |
std::cout << "\nDouble = " << doubleResult; | |
//return std::make_pair(floatResult, doubleResult); | |
} | |
void main() | |
{ | |
double x = 0, y = 0; | |
std::cout << "Please enter X = " && std::cin >> x; | |
std::cout << "Please enter Y = " && std::cin >> y; | |
std::cout << "\nBlock 8.1 = " << firstBlock(x); | |
std::cout << "\nBlock 8.2 = "; | |
secondBlock(x, y); | |
std::cout << "\nBlock 8.3: \n"; | |
thirdBlock(); | |
system("pause"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://ideone.com/zWzboX