The gravitational force between two objects is given by the formula
$F = G \frac{m_1 m_2}{r^2}$
where $G$ is the gravitational constant while the variables in the numerator represent the masses of the two objects. Your function declaration should be:
double gravitational_force( double mass_1, double position_1[3], double mass_2, double position_2[3] );
The position vectors give two points in 3-dimensional space, and the distance between these two points is the quantity $r$ in the formula.
If either mass is negative, throw a std::domain_error exception.
Your documentation should be clear as to the units of each of the parameters and the units of the return value.
Write a similar function, but now for Coulomb's law:
$F = k_e \frac{q_1 q_2}{r^2}$
where $k_e$ is Coulomb's constant where the variables in the numerator represent the charge on each of the two objects. Your function declaration should be:
double coulombs_law( double charge_1, double position_1[3], double charge_2, double position_2[3] );
Again, you should document the units of the parameters and the return value.