.


:




:

































 

 

 

 


.2




 


, .

[-2;2] 0.4

.1 ˳

#include <iostream>

#include <conio.h>

 

using namespace std;

 

double y, min(999);

 

void staticEdges() {

double

h = 0.4;

int i = 1,

a = -2,

b = 2;

 

cout << "\n\nMezhi: [" << a << "," << b << "].\n\n";

 

for (double x(a); x <= b; x+=h) {

double y = abs(pow(x, 3) - 4.2 * pow(x, 2)) + cos(5 * x) * sin(3 * x);

if (min > y)

min = y;

cout << i << " iteratsia = " << y << endl;

i++;

}

}

 

void customEdges() {

double

h;

int i = 1,

a,

b;

cout << "\n\nVvedit mezhi: ";

cin >> a >> b;

 

cout << "Vvedit krok: ";

cin >> h;

 

cout << "\n\nMezhi: [" << a << "," << b << "].\n\n";

 

for (double x(a); x <= b; x += h) {

double y = abs(pow(x, 3) - 4.2 * pow(x, 2)) + cos(5 * x) * sin(3 * x);

if (min > y)

min = y;

cout << i << " iteratsia = " << y << endl;

i++;

}

}

 

int main() {

 

cout << "Vuberit tup:\n1. Konstantu\n2. Korustyvatski\n\n";

 

int menu;

 

cin >> menu;

 

menu == 1? staticEdges(): customEdges();

 

cout << "\n\nMinimum = " << min;

 

_getch();

return 0;

}

.2

 

 


. .

5.5 -3.6 63 0.54

 

.1 ˳

 

#include <iostream>

#include <conio.h>

 

using namespace std;

 

double staticEdges() {

double

a = 5.5,

b = -3.6,

c = 63,

d = 0.54;

return sin(a) * log(d * c) + pow(b - 1, 2) / 3;

}

 

double customEdges() {

double

a,

b,

c,

d;

 

cout << "\n\nVvedit zminni (a, b, c, d): ";

cin >> a >> b >> c >> d;

 

return sin(a) * log(d * c) + pow(b - 1, 2) / 3;

}

 

int main() {

 

cout << "Vuberit tup:\n1. Konstantu\n2. Korustyvatski\n\n";

 

int menu;

 

cin >> menu;

 

double y;

 

menu == 1? y = staticEdges(): y = customEdges();

 

cout << "\n\nRezultat = " << y;

 

_getch();

return 0;

}


.2


.

.1 ˳

#include <iostream>

#include <conio.h>

 

using namespace std;

 

int main() {

double d;

 

cout << "Vvedit diametr: ";

cin >> d;

 

cout << "C = " << 3.14 * d;

cout << "\nS = " << (3.14 * pow(d, 2))/4;

 

_getch();

return 0;

}

.2

 


W a r.





:


: 2016-11-18; !; : 488 |


:

:

,
==> ...

1876 - | 1647 -


© 2015-2024 lektsii.org - -

: 0.014 .