summaryrefslogtreecommitdiff
path: root/I_anno/Programmazione_1/ex1_27_01_20.cc
diff options
context:
space:
mode:
authorSanto Cariotti <dcariotti24@gmail.com>2020-10-18 18:56:43 +0200
committerSanto Cariotti <dcariotti24@gmail.com>2020-10-20 09:08:52 +0200
commitf279107065146a4940f5e73602a1c3c09e58b31d (patch)
treefd892749637a8b6c5c31ccb80bba04ade76ab87a /I_anno/Programmazione_1/ex1_27_01_20.cc
parent4e063e32250312c38d5646840719b62429362b21 (diff)
chore: name of first year folder
Diffstat (limited to 'I_anno/Programmazione_1/ex1_27_01_20.cc')
-rw-r--r--I_anno/Programmazione_1/ex1_27_01_20.cc47
1 files changed, 0 insertions, 47 deletions
diff --git a/I_anno/Programmazione_1/ex1_27_01_20.cc b/I_anno/Programmazione_1/ex1_27_01_20.cc
deleted file mode 100644
index 1b0e529..0000000
--- a/I_anno/Programmazione_1/ex1_27_01_20.cc
+++ /dev/null
@@ -1,47 +0,0 @@
-#include<iostream>
-#define N 3
-#define M 4
-using namespace std;
-
-float* func(int** Q, float a, float b) {
- float* arr = new float[M];
-
- int a_i = static_cast<int>(a);
- int b_i = static_cast<int>(b);
-
- for(int i = 0; i < M; ++i) {
- short counter{};
- float sum{};
- for(int j = 0; j < N; ++j) {
- if(Q[j][i]) {
- if(Q[j][i] >= a_i && Q[j][i] <= b_i) {
- ++counter;
- sum += Q[j][i];
- }
- }
- }
-
- arr[i] = (sum / static_cast<float>(counter));
- }
-
- return arr;
-}
-
-int main() {
- int** A = new int*[N];
- for(int i = 0; i < N; ++i) {
- A[i] = new int[M];
- for(int j = 0; j < M; ++j)
- A[i][j] = 24;
- }
-
- float* arr = func(A, 1.0, 33.0);
-
- for(int j = 0; j < M; ++j)
- cout << arr[j] << ' ';
-
- delete[] A;
- delete arr;
-
- return 0;
-}