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

2 семестр / лр3 / Laba_2

.doc
Скачиваний:
16
Добавлен:
19.09.2019
Размер:
50.18 Кб
Скачать

#include <iostream>

#include <iomanip>

#include <math.h>

using namespace std;

int main()

{

double x, y;

cout.precision(5);

cout << setw(10) << "x=" << "\t" << setw(10) << "y=" << endl;

for (x = 0.5; x <= 5; x += 2.1)

{

y = 2 * exp(4 * x);

cout << setw(10) << x << "\t" << setw(10) << y << endl;

}

return 0;

}

#include <iostream>

#include <iomanip>

#include <math.h>

using namespace std;

int main()

{

double x, y;

cout.precision(5);

cout << setw(10) << "x=" << "\t" << setw(10) << "y=" << endl;

x = 0.5;

while (x<=5)

{

y = 2 * exp(4 * x);

cout << setw(10) << x << "\t" << setw(10) << y << endl;

x += 2.1;

}

return 0;

}

#include <iostream>

#include <iomanip>

#include <math.h>

using namespace std;

int main()

{

double x, y;

cout.precision(5);

cout << setw(10) << "x=" << "\t" << setw(10) << "y=" << endl;

x = 0.5;

do

{

y = 2 * exp(4 * x);

cout << setw(10) << x << "\t" << setw(10) << y << endl;

x += 2.1;

} while (x <= 5);

return 0;

}

Задание 2

#include <iostream>

#include <iomanip>

#include <math.h>

using namespace std;

int main()

{

double x, y, z,s, p, min, max;

min = 10000;

max = 10000;

s = 0;

p = 1;

cout.precision(5);

cout << setw(10) << "x=" << "\t" << setw(10) << "y=" << "\t" << setw(10) << "z=" << endl;

for (x = 2; x <= 3.2; x += 0.7)

for (y = 0.5; y <= 1; y += 0.22)

{

if ((x / y) < 1)

z = (pow(y, 1. / 3)*(4 * pow(x, 2) + 1)) / (3 * pow(cos(fabs(x - y)), 2));

else

z = (tan(x*y) + 2.6) / (sqrt(sin(x)));

cout << setw(10) << x << "\t" << setw(10) << y << "\t" << setw(10) << z << endl;

if (min < z)

min = z;

if (max > 2)

max = z;

s = s + z;

p = p*z;

}

cout << "s=" << s << endl;

cout << "p=" << p << endl;

return 0;

}

}

Задание 3

#include <iostream>

#include <iomanip>

#include <math.h>

using namespace std;

int main()

{

double x, y, a, b, z;

cout.precision(5);

cout << setw(10) << "x=" << "\t" << setw(10) << "y=" << "\t" << setw(10) << "z=" << endl;

x = 2.5;

while (x<=5)

{

y = 3;

while (y<=3.5)

{

a = log(x + (x / y));

b = (pow(y, 1. / 3)*(4 * pow(x, 2) + 1)) / (3 * pow(cos(fabs(x - y)), 2));

if (a < b)

z = a;

else

z = b;

cout << setw(10) << x << "\t" << setw(10) << y << "\t" << setw(10) << z << endl;

y = y + 0.25;

}

x = x + 2;

}

return 0;

}

Соседние файлы в папке лр3