diff options
author | Santo Cariotti <dcariotti24@gmail.com> | 2020-10-18 18:56:43 +0200 |
---|---|---|
committer | Santo Cariotti <dcariotti24@gmail.com> | 2020-10-18 18:59:42 +0200 |
commit | 6c6328375c55683645146909b7ab760d0de0d463 (patch) | |
tree | b18e695dfe7a10064fed111649253dc2c77208bf /I_anno/Programmazione_1/ex12.cc | |
parent | 4e063e32250312c38d5646840719b62429362b21 (diff) |
chore: name of first year folder
Diffstat (limited to 'I_anno/Programmazione_1/ex12.cc')
-rw-r--r-- | I_anno/Programmazione_1/ex12.cc | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/I_anno/Programmazione_1/ex12.cc b/I_anno/Programmazione_1/ex12.cc deleted file mode 100644 index ab20cef..0000000 --- a/I_anno/Programmazione_1/ex12.cc +++ /dev/null @@ -1,50 +0,0 @@ -#include <iostream> -#include <vector> -#define N 3 -using namespace std; - -string* func(string a[N][N], short k, string s) { - string* sn = new string[N]; - vector<string> l; - - // Diagonale secondaria - for(int i = N-1, j = 0; i >= 0; --i, ++j) { - l.push_back(a[i][j]); - } - - bool d2 = true; - for(auto const& i : l) { - if(i.length() < k || i.find(s) != 0) { - d2 = false; - break; - } - } - - if(d2) { - for(int i = 0; i < N; ++i) { - sn[i] = l.at(i); - } - } else { - for(int i = 0; i < N; ++i) { - sn[i] = a[i][i]; - } - } - - return sn; -} - -int main() { - string a[N][N] = { - {"aab", "bbc", "4de"}, - {"xyb", "bbc", "yz3"}, - {"47x", "1y_", "23g"}, - }; - string* x = func(a, 1, "4"); - - for(int i = 0; i < N; ++i) - cout << x[i] << ' '; - - cout << endl; - - return 0; -} |