You are viewing a single comment's thread. Return to all comments →
void plusMinus(vector arr) { int positive = 0, negative = 0, zero = 0; int n = arr.size();
for (int num : arr) { if (num > 0) positive++; else if (num < 0) negative++; else zero++; } cout << fixed << setprecision(6); cout << (double)positive / n << endl; cout << (double)negative / n << endl; cout << (double)zero / n << endl;
}
Seems like cookies are disabled on this browser, please enable them to open this website
Plus Minus
You are viewing a single comment's thread. Return to all comments →
void plusMinus(vector arr) { int positive = 0, negative = 0, zero = 0; int n = arr.size();
}