In C++ Code
When an object is falling because of gravity, the followingformula can be used to determine the distance the object falls in aspecific time period:
d = 1/2 gt2
The variables in the formula are as follows: d is the distancein meters, g is 9.8, and t is the amount of time, in seconds, thatthe object has been falling.
Write a functionnamed fallingDistance that accepts anobject’s falling time (in seconds) as an argument. The functionshould return the distance, in meters, that the object has fallenduring that time interval. Write a program that demonstrates thefunction by prompting the user for the total time and callingthe function in a loop that passes the time values in 5second increments as the argument and displays the elapsed time andreturn value. The output should have a header identifyingthe column names and tabular formatted values (values displayed areto illustrate formatting only):
In C++ Code When an object is falling because of gravity, the following formula can be used to determine the distance th
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am