-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogram.cpp
More file actions
42 lines (38 loc) · 705 Bytes
/
program.cpp
File metadata and controls
42 lines (38 loc) · 705 Bytes
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
#include <vector>
std::vector<int> InsetSort(std::vector<int> a) {
int i=1;
while (i < 10) {
int elem=a[i];
int loc=i - 1;
while (loc >= 0 && a[loc] > elem) {
a[loc + 1]=a[loc];
loc=loc - 1;
}
a[loc + 1]=elem;
i=i + 1;
}
return a;
}
float findMaxBiggerThanElem(std::vector<float> array, float elemCompare) {
float max=-1;
for (auto elem : array) {
if (elem > elemCompare) {
max=elem;
}
}
return max;
}
int main() {
int size=10;
std::vector<float> floatArray(size);
for (auto i=0; i < size; i++) {
floatArray[i]=i;
}
float maxValue=findMaxBiggerThanElem(floatArray, 10);
if (maxValue < 100) {
maxValue=size;
} else {
maxValue=100;
}
return 0;
}