Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- double f(double x) {
- return x*x/50;
- }
- double g(double x) {
- return 1+x*x/100-x/200;
- }
- double task_one() {
- double surface = 0;
- float step = 0.1;
- //nad OX
- for (float i = 0; i < 10; i += step) {
- double a = g(i);
- double b = g(i+step);
- surface += ((a+b)*step)/2;
- }
- //pod OY
- for (float i = 0; i < 10; i += step) {
- double a = f(i);
- double b = f(i+step);
- surface += ((a+b)*step)/2;
- }
- cout.precision(4);
- return surface;
- }
- double task_two() {
- int a = 26;
- int b = 100;
- double minX, maxX, minY, maxY;
- for (double i = 0; ; i++) {
- if ((int)g(i) + (int)f(i) >= a) {
- minX = i;
- maxX = i + b;
- maxY = (int)g(i);
- minY = maxY - a;
- break;
- }
- }
- cout << "C- " << maxX << endl;
- cout << "A: " << minX << " , " << maxY << endl;
- cout << "B: " << minX << " , " << minY << endl;
- cout << "C: " << maxX << " , " << maxY << endl;
- cout << "D: " << maxX << " , " << minY << endl;
- }
- int main() {
- cout << task_one() << endl;
- task_two();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement