P
Protoman
I have a function that calculates the mean of the some numbers; I need
it to accept any number of parameters (one needs to be the number of
the other parameters) Can you help me out here? Here's the function:
const long double& mean(long long x)
{
vector<int> v(x);
for(int i= 1; i <=x; ++i)
{
v.push_back(i);
}
const long double ret=accumulate(v.begin(), v.end(), 0.0) / v.size();
return ret;
}
I want it to calculate the vector size at runtime. If you could help me
out, that'd be great. Thanks!!!
it to accept any number of parameters (one needs to be the number of
the other parameters) Can you help me out here? Here's the function:
const long double& mean(long long x)
{
vector<int> v(x);
for(int i= 1; i <=x; ++i)
{
v.push_back(i);
}
const long double ret=accumulate(v.begin(), v.end(), 0.0) / v.size();
return ret;
}
I want it to calculate the vector size at runtime. If you could help me
out, that'd be great. Thanks!!!