//thema1_Jun16.hpp // ΛΥΣΕΙΣ ΘΕΜΑΤΩΝ ΣΕΠΤΕΜΒΡΗ 2016 // ΘΕΜΑ 1. #ifndef thema1_Sept16_hpp // περιορισμός ορισμού του "thema1_Jun16.hpp" μόνο μια φορά #define thema1_Sept16_hpp #define sign(x) ((x > 0)?(1):(-1)) void signs(int n, int a[], int b[]){ for (int i = 0; i < n; i++){ if(a[i] == 0) b[i] = 0; else b[i] = sign(a[i]); } } void count(int n, int a[], int &count1, int &count0, int &countm1){ for (int i = 0; i < n; i++){ if (a[i] == 1) count1++; if (a[i] == 0) count0++; if (a[i] == -1) countm1++; } } #endif