You are viewing a single comment's thread. Return to all comments →
c++ solution
void plusMinus(vector<int> arr) { double countp = 0, countn = 0, countz = 0; for(int i = 0; i < arr.size(); i++) { if(arr[i] > 0) { countp++; } else if(arr[i] < 0) { countn++; } else { countz++; } } vector<double> v; v.push_back(countp); v.push_back(countn); v.push_back(countz); for (int i = 0; i < v.size(); i++) { cout << double(v[i]/arr.size()) << 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 →
c++ solution