You are viewing a single comment's thread. Return to all comments →
C++11
/* * Complete the 'plusMinus' function below. * * The function accepts INTEGER_ARRAY arr as parameter. */
void plusMinus(vector arr) { float positive = 0, negative = 0, zero = 0; int total = arr.size();
for(int i=0; i<total; i++){ if(arr[i]>0){ positive++; } else if(arr[i]<0){ negative++; } else{ zero++; } } cout<< positive/total <<endl; cout<< negative/total <<endl; cout<< zero/total <<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++11
/* * Complete the 'plusMinus' function below. * * The function accepts INTEGER_ARRAY arr as parameter. */
void plusMinus(vector arr) { float positive = 0, negative = 0, zero = 0; int total = arr.size();
}