-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlambdaFunc.cpp
More file actions
65 lines (65 loc) · 1.64 KB
/
lambdaFunc.cpp
File metadata and controls
65 lines (65 loc) · 1.64 KB
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
65
//#include <iostream>
//#include <algorithm>
//using namespace std;
//
//void Rand_100(int* mas, int n)
//{
// for (int i = 0; i < n; i++)
// mas[i] = -100 + rand() % 201;
//}
//
//void Print(int* mas, int n)
//{
//
// for (int i = 0; i < n; i++)
// {
// cout << mas[i] << "\t";
// }
// cout << "\n";
//}
//
//void PrintBilsheNum(int* mas, int n, int num)
//{
//
// for (int i = 0; i < n; i++)
// {
// if (mas[i] > num)
// cout << mas[i] << "\t";
// }
// cout << "\n";
//}
//
//int main()
//{
// cout << "----------Zavdannia 1------------\n";
// //1. Ñãåíåðóéòå ìàñèâ äîâæèíîþ 20 ö³ëèõ ÷èñåë ³ çàïîâí³òü éîãî âèïàäêîâèìè ÷èñëàìè â³ä - 100 äî 100. Âèêîðèñòîâóþ÷è ëÿìáäó, â³äñîðòóéòå çíà÷åííÿ > 10 .
// srand(time(0));
// const int n = 20;
// int mas1[n];
// Rand_100(mas1, n);
// Print(mas1, n);
// sort(mas1, mas1 + n, [](int a, int b) {
// return (a > 10 && b > 10) ? a < b : (a > 10);
// /* if (a > 10 && b > 10)
// {
// return a < b;
// }
// else
// {
// return a > 10;
// }*/
// });
// cout << "Vidsortovani elementu massuvy (>10):\n";
// Print(mas1, n);
// PrintBilsheNum(mas1, n, 10);
//
// cout << "----------Zavdannia 2------------\n";
// //2. Ñãåíåðóéòå ìàñèâ äîâæèíîþ 20 ö³ëèõ ÷èñåë ³ çàïîâí³òü éîãî âèïàäêîâèìè ÷èñëàìè â³ä - 10 äî 10. Âèêîðèñòîâóþ÷è ëÿìáäó, âèâåä³òü êâàäðàòè öèõ ÷èñåë.
// int mas2[n];
// Rand_100(mas2, n);
// Print(mas2, n);
// cout << "Kvadratu elementiv massuvy:\n";
// for_each(mas2, mas2 + n, [](int num) {
// cout << num * num << " ";
// });
//}