You can pass references to two doubles into a function, setting their values inside the function
void setTwoDoubles(double& d1, double& d2)
{
d1 = 1.0;
d2 = 2.0;
}
double d1, d2;
setTwoDoubles(d1, d2);
std::cout << "d1=" << d1 << ", d2=" << d2 << std::endl