-
Notifications
You must be signed in to change notification settings - Fork 0
/
11-19.cpp
64 lines (52 loc) · 1.72 KB
/
11-19.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "stdafx.h"
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
/*
ÇÀÄÀÍÈÅ 11.19
*/
int main()
{
setlocale(0, "Russian");
srand((unsigned)time(NULL));
int a = 0, b = 0, v = 0, g = 0, d = 0, e = 0, j = 0, sum = 0, k1 = 0, k2 = 0, s1 = 0, s2 = 0;
int array[] = { 0, 0, 0, 0, 0, 0, 0 };
int array_size = sizeof(array) / sizeof(int);
while (!(k2 > k1) || !(s2 > s1)) {
cout << "Óñëîâèå: K2 > K1" << endl;
cout << "Ââåäèòå ÷èñëî K2: "; cin >> k2;
cout << "Ââåäèòå ÷èñëî K1: "; cin >> k1;
cout << "\n";
cout << "Óñëîâèå: S2 > S1" << endl;
cout << "Ââåäèòå ÷èñëî S2: "; cin >> s2;
cout << "Ââåäèòå ÷èñëî S1: "; cin >> s1;
system("cls");
}
array[0] = k1;
array[1] = k2;
array[2] = s1;
array[3] = s2;
for (int i = 4; i < array_size; i++) {
array[i] = rand() % 89 + 10;
}
for (int i = 0; i < 7; i++) {
a += array[i];
b *= array[i];
v += pow(array[i], 2);
if (i < 5) g += array[i];
if (i < 3) d += array[0] + array[1];
e += array[i] / array_size;
if (i > 2 && i < 5) j += array[2] + array[3];
}
cout << "Äàíû ÷èñëà: " << array[0] << " | " << array[1] << " | " << array[2] << " | " << array[3] << " | " << array[4] << " | " << array[5] << " | " << array[6] << endl << endl;
cout << "Ñóììà âñåõ ýëåìåíòîâ: " << a << endl;
cout << "Ïðîèçâåäåíèå âñåõ ýëåìåíòîâ: " << b << endl;
cout << "Ñóììà êâàäðàòîâ âñåõ ýëåìåíòîâ: " << v << endl;
cout << "Ñóììà øåñòè ïåðâûõ ýëåìåíòîâ: " << g << endl;
cout << "Ñóììà ýëåìåíòîâ ñ K1 ïî K2: " << d << endl;
cout << "Ñðåäíåå àðèôìåòè÷åñêîå ýëåìåíòîâ âñåõ ýëåìåíòîâ: " << e << endl;
cout << "Ñðåäíåå àðèôìåòè÷åñêîå ñ S1 ïî S2: " << j << endl;
system("pause");
return 0;
}