Category : average

I am writing code that removes the minimum and maximum values from a vector, and then averages the remaining values. I have this code: #include <vector> #include <bits/stdc++.h> #include <algorithm> using namespace std; double averageWithoutOutliers(vector<int> values) { double max = *max_element(values.begin(),values.end()); values.erase(std::remove(values.begin(), values.end(), max), values.end()); double min = *min_element(values.begin(),values.end()); values.erase(std::remove(values.begin(), values.end(), min), values.end()); auto n ..

Read more

I am trying to develop a code that accepts input numbers from user then they would press enter and the numbers input the average will be found. My issue is line 14 which says error: primary-expression before ‘)’ token #include <iostream> using namespace std; int main() { int num, sum, count; float average; sum=0; count=0; ..

Read more