ASTeterin / OOP

0 stars 0 forks source link

Замечания по ProcessVector #5

Closed alexey-malov closed 5 years ago

alexey-malov commented 5 years ago
alexey-malov commented 5 years ago
double MinElementVector(vector<double> const& v)
{
    if (v.empty())
    {
        return NULL;
    }
    else
    {
        return *min_element(v.begin(), v.end());
    }
}
alexey-malov commented 5 years ago
void ProcessVector(vector<double> &v)
{
    double min = MinElementVector(v);
    if (!min)
    {
        return;
    }
    for (size_t i = 0; i < v.size(); i++)
    {
        v[i] *= min;
    }
}