P
Protoman
I have a function that calculates the mean of the some numbers; I want
it to calculate the vector size at runtime. 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;
}
If you could help me out, that'd be great. Thanks!!!
it to calculate the vector size at runtime. 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;
}
If you could help me out, that'd be great. Thanks!!!