Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

экз / ekz_bilety 3,5,7

.pdf
Скачиваний:
4
Добавлен:
10.06.2023
Размер:
253.94 Кб
Скачать

Билет 3

#2

#include <iostream> #include "f.h"

using namespace std;

int main()

{

setlocale(LC_ALL, "ru");

double d1, d2, y1, f1, f2, y2, s1, s2;

cout << "\tВведите основания первой трапеции : \n\td1 = "; cin >> d1;

cout << "\td2 = "; cin >> d2;

cout << "\tВведите угол при большем основании первой трапеции : \n\ty1 = "; cin >> y1;

cout << "\tВведите основания второй трапеции : \n\tf1 = "; cin >> f1;

cout << "\tf2 = "; cin >> f2;

cout << "\tВведите угол при большем основании второй трапеции : \n\ty1 = "; cin >> y2;

s1 = p(d1, d2, y1);

s2 = p(f1, f2, y2);

cout << "\tПлощадь первой трапеции = " << s1; cout << "\tПлощадь второй трапеции = " << s2; return 0;

}

|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

#pragma once #include <cmath>

#define _USE_MATH_DEFINES #include "math.h"

using namespace std;

double p(double a, double b, double y)

{

double h = abs(a - b) / 2 * cos(y * M_PI / 180); double s = (a + b) * h / 2;

return s;

}

#3

#include <iostream> #include "f.h"

using namespace std;

void main()

{

setlocale(LC_ALL, "ru"); double x, f;

cout << "\tВведите x = "; cin >> x;

fx(x, f);

cout << "\n\tОтвет: " << f;

}

||||||||||||||||||||||||||||||||||||

#pragma once #include <cmath>

#include <iostream>

using namespace std;

void fx(double x, double& f)

{

if ((0 <= x) && (x <= 5))

{

double f1, f2, f3; f = 5 * exp(x); f1 = tan(x);

f2 = pow(x, 3);

f3 = abs(x);

if (f < f1) f = f1; if (f < f2) f = f2; if (f < f3) f = f3;

}

if (x > 5)

{

double f1;

f = 2 * sin(x);

f1 = pow(cos(x), 3); if (f1 < f) f = f1;

}

if (x < 0) f = exp(-3 * x);

}

#4

#include <iostream> #include "f.h"

using namespace std;

void main()

{

setlocale(LC_ALL, "ru"); double a, b, c, h, y;

cout << "\tВведите границы отрезка: \n"; cout << "\ta = ";

cin >> a;

cout << "\tb = "; cin >> b;

cout << "\tВведите шаг: "; cin >> h;

if (b < a)

{

c = b; b = a; a = c;

}

y = f(a, b, h);

cout << "\tНаибольшее значение на данном отрезке y = " << y;

}

||||||||||||||||||

#pragma once #include <iostream> using namespace std;

double f(double a, double b, double h)

{

double y = -1E308;

int n = ((b + h / 2 - a) / h) + 1; for (double i = 1; i <= n; i += 1)

{

double x, y1;

x = a + (i - 1) * h;

y1 = pow(sin(pow(x, 2)), 3); if (y1 > y) y = y1;

}

return y;

}

#5

#include <iostream> #include <iomanip> #include "f.h" using namespace std;

int main()

{

setlocale(LC_ALL, "ru"); double e, x, s;

cout << "x = "; cin >> x;

cout << "e = "; cin >> e;

s = fx(e, x);

cout << "s = " << setprecision(32) << s;

}

|||||||||||||||||||||||||||||||||||||||

#pragma once #include <iostream> #include <cmath> using namespace std;

double fx(double e, double x)

{

int n = 0; double s1 = 1/x; double s = 0;

while (abs(s1) >= e && n < 100)

{

s += s1;

s1 = (-s1 * pow(x, 2)) / ((3 * n + 4) * (3 * n + 3) * (3 * n + 2)); n++;

}

return s;

}

Билет 5

#2

#include <iostream> #include "f2.h"

using namespace std;

void main()

{

double F, L, a, b, A; cout << "\tF = "; cin >> F;

cout << "\tL = "; cin >> L;

cout << "\talfa = "; cin >> a;

cout << "\tbeta = ";

cin >> b; f(F, L, a, A);

cout << "\tA1 = " << A; f(F, L, b, A);

cout << "\tA2 = " << A;

}

|||||||||||||||||||||||||||||||||||||||||||||||||

#pragma once #include <iostream> #include <cmath> using namespace std;

void f(double F, double L, double a, double& A)

{

A = F * L * cos(a);

}

#3

#include <iostream> #include "f3.h"

using namespace std;

void main()

{

double x, b; cout << "x = "; cin >> x;

f(x, b);

cout << "b = " << b;

}

|||||||||||||||||||||||||||||||||||||||

#pragma once #include <cmath>

void f(double x, double& b)

{

if ((0 <= x) && (x <= 5))

{

b = pow(sin(x), 2); double b1 = tan(x);

double b2 = sqrt(pow(x, 3)); if (b > b1) b = b1;

if (b > b2) b = b2;

}

if (x > 5)

{

b = exp(-x);

double b1 = 2 * sin(x); double b2 = pow(cos(x), 3); double b3 = log(x);

if (b < b1) b = b1; if (b < b2) b = b2; if (b < b3) b = b3;

}

if (x < 0) b = exp(-3 * x);

}

#4

#include <iostream> #include "f4.h" using namespace std;

void main()

{

double a, b, c, d, hx, hy; int s;

cout << "a = "; cin >> a;

cout << "b = "; cin >> b;

cout << "hx = "; cin >> hx;

cout << "c = "; cin >> c;

cout << "d = "; cin >> d;

cout << "hy = "; cin >> hy;

s = f(a, b, hx, c, d, hy); cout << "s = " << s;

}

||||||||||||||||||||||||||||||||||||

#pragma once #include <cmath>

int f(double a, double b, double hx, double c, double d, double hy)

{

double s = 0;

int nx = ((b + hx / 2 - a) / hx) + 1; int ny = ((b + hy / 2 - a) / hy) + 1; for (int i = 1; i <= nx; i++)

{

double x = a + (i - 1) * hx; for (int I = 1; I <= ny; I++)

{

double y = c + (I - 1) * hy; double z = sqrt(sqrt(y)) / (3 * x); if (z < 0) s += z;

}

}

return s;

}

#5

#include <iostream> #include "f5.h" using namespace std;

void main()

{

double x, e, s; cout << "x = "; cin >> x;

cout << "e = "; cin >> e;

f(x, e, s);

cout << "s = " << s;

}

|||||||||||||||||||||||||||||||||

#pragma once

#include <iostream> #include <cmath>

void f(double x, double e, double& s)

{

double X = -x; int n = 0;

s = 0;

while (abs(X) >= e)

{

s += X;

X = (-X * pow(x, 2)) / ((3 * n + 3) * (3 * n + 3) * (3 * n + 3)); n += 1;

}

}

Билет 7

#2

#include <iostream> #include "f2.h"

using namespace std;

void main()

{

setlocale(LC_ALL, "ru"); double a, b, c, A, B;

cout << "\tВведите известную сторону треугольника : \n\tc = "; cin >> c;

cout << "\tВведите углы прилегающие к этой стороне : \n\ta = "; cin >> a;

cout << "\tb = "; cin >> b;

f(c, a, b, A, B);

cout << "\tСторона А = " << A; cout << "\tСторона B = " << B;

}

||||||||||||||||||||||||||||||||||||||||

#pragma once

#define _USE_MATH_DEFINES #include <math.h>

void f(double c, double a, double b, double& A, double& B)

{

double y = M_PI - a - b; A = c * sin(a) / sin(y); B = A * sin(b) / sin(a);

}

#3

#include <iostream> #include "f3.h" using namespace std;

void main()

{

setlocale(LC_ALL, "ru"); double x, y, c, d, f;

cout << "\tВведите:\n\tx = "; cin >> x;

cout << "\ty = "; cin >> y;

cout << "\tc = "; cin >> c;

cout << "\td = "; cin >> d;

fx(x, y, c, d, f);

cout << "\tРешением системы будет :\n\tf = " << f;

}

||||||||||||||||||||||||||||||||||||||||||||||||||||

#pragma once #include <iostream> #include <math.h>

using namespace std;

void fx(double x, double y, double c, double d, double& f)

{

if ((x > 0) && (exp(-x) >= y))

{

f = pow(x, 3);

double f1 = exp(-x + 1), f2 = log10(x), f3 = (x + y); if (f2 < f3) f2 = f3;

if (f > f1) f = f1; if (f > f2) f = f2;

}

if ((x <= 0) && (exp(-x) >= y)) f = 1 - pow(x, 2); if (exp(-x) < y)

{

f = pow(c, 2) * x;

if (f < d * cos(x + y)) f = d * cos(x + y);

}

}

#4

#include <iostream> #include "f4.h" using namespace std;

void main()

{

setlocale(LC_ALL, "ru"); double a, b, d, h;

int c;

cout << "\tВведите границы отрезка:\n\ta = "; cin >> a;

cout << "\tb = "; cin >> b;

cout << "\tВведите шаг:\n\th = "; cin >> h;

if (a > b)

{

d = b; b = a; a = d;

}

f(a, b, h, c);

cout << "\tКолличество ненулевых значений y:\n\tc = " << c;

}

||||||||||||||||||||||||||||||||||||||||||

#pragma once #include <iostream> #include <cmath>

using namespace std;

void f(double a, double b, double h, int& c)

{

c = 0; int n;

n = int((b + h / 2 - a) / h) + 1; for (int i = 1; i <= n; i += 1)

{

double y, x = a + (i - 1) * h; if (x > 2) y = exp(x);

if ((-2 <= x) && (x <= 2)) y = x + 4; if (x < -2) y = 0;

if (y != 0) c += 1;

}

}

#5

#include <iostream> #include "f5.h"

using namespace std;

void main()

{

double x, e, s; cout << "\tx = "; cin >> x;

cout << "\te = "; cin >> e;

fx(x, e, s);

cout << "\ts = " << s;

}

||||||||||||||||||||||||||||||

#pragma once #include <cmath> using namespace std;

void fx(double x, double e, double& s)

{

double X = 1, n = 0; s = 0;

while ((abs(X) >= e) && (n<=100))

{

s += X;

X = X * (-pow(x, 2)) / ((2 * n + 3) * (2 * n + 2)); n++;

}

}

Соседние файлы в папке экз