Newton’s Law says that the force, F, between two bodies of masses M1 and M2 is given by
f=k(m1,m2/d^2)
Where k is the gravitational constant and d is the distance between the bodies. The value of k is approximately 6.67 x 10-8 dyn.cm2/g2. Write a program that prompts the user to input the masses of the bodies and the distance between the bodies. The program then outputs the force between the bodies.
NOTE: You are required to use the in-built methods of the Math class.

We tend not to just give you working code. Is it that you don't understand the equation, or that you struggle with the C++ code?

Note that C++ has a standard math library, but no math class. Do you have some kind of math class that you are to use, or does the question mean to use the math library?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.