From d2edbc38cac8da52f58c5cd3da6c0c625fa05736 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Sat, 6 Feb 2021 19:56:36 +0100 Subject: conf: rename --- 1_anno/Programmazione_1/ex13.cc | 45 ----------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 1_anno/Programmazione_1/ex13.cc (limited to '1_anno/Programmazione_1/ex13.cc') diff --git a/1_anno/Programmazione_1/ex13.cc b/1_anno/Programmazione_1/ex13.cc deleted file mode 100644 index f9f19fa..0000000 --- a/1_anno/Programmazione_1/ex13.cc +++ /dev/null @@ -1,45 +0,0 @@ -#include -#include -#include -#include -using namespace std; - -template -unique_ptr func(int (&A)[K][N], int (&B)[N][K]) { - auto arr = unique_ptr(new double{K}); - for(int i = 0; i < K; ++i) { - vector t; - int sum = 0; - for(int j = 0; j < N; ++j) { - t.push_back(B[j][i]); - sum+=A[i][j]; - } - - double media = static_cast(sum)/N; - auto min_num = min_element(begin(t), end(t)); - arr[i] = media - *min_num; - } - - return arr; -} - -int main() { - const int N2 = 3, K2 = 2; - int A[K2][N2] = { - {3, 7, 10}, - {5, 12, 32}, - }; - int B[N2][K2] = { - {12, 10}, - {15, 17}, - {8, 0}, - }; - auto x = func(A, B); - - for(int i = 0; i < K2; ++i) - cout << x[i] << ' '; - - cout << endl; - - return 0; -} -- cgit v1.2.3-18-g5258