Respuesta :
Creating a multi-function program with the name findfallingdist. cpp:
fallingDist(double seconds, double &distOnEarth, double &distOnMoon)
The function should take two arguments:
- seconds, which is the number of seconds the object is falling;
- and istOnEarth, which is a reference variable that will be set equal to the distance the object falls on earth;
- and distOnMoon, which is a reference variable that will be set equal to the distance the object falls on the moon.
The function should return void.
You can assume the following:
the acceleration of gravity is 9.8 m/s2 on earth and 1.6 m/s2 on the moon;
the radius of the earth is 6.371E6 m and the radius of the moon is 1.737E6 m;
Expected Output
Your program should produce the following output:
Input the number of seconds: 3
Distance on Earth: 29.4
Distance on Moon: 3.7
*/
#include <iostream>
#include <cmath>
using namespace std;
void fallingDist(double seconds, double &distOnEarth, double &distOnMoon);
int main()
{
double seconds, distOnEarth, distOnMoon;
cout << "Input the number of seconds: " << endl;
cin >> seconds;
fallingDist(seconds, distOnEarth, distOnMoon);
cout << "Distance on Earth: " << distOnEarth << endl;
cout << "Distance on Moon: " << distOnMoon << endl;
}
void fallingDist(double seconds, double &distOnEarth, double &distOnMoon)
{
distOnEarth = 0.5 * 9.8 * pow(seconds, 2);
distOnMoon = 0.5 * 1.6 * pow(seconds, 2);
}
Learn more about programming:
https://brainly.com/question/18900609
#SPJ4