Question: write a C++ only code, this program consists of the use of for-statements please write the complete code, and show that it runs Write a

 write a C++ only code, this program consists of the use

write a C++ only code, this program consists of the use of for-statements

please write the complete code, and show that it runs

Write a program that calculates velocity, v, and distance, x, given time, t, and acceleration due to gravity, a. The program will print out f, x, and v for each time point in tabular form. The program should prompt for total time (in seconds), and step- size (in seconds) for the calculations, and print out the table of results. An example run: Enter the time, in seconds: 0.1 Enter the step-size, in seconds: o.01 t: 0.0000 sec t: 0.0100 sec t: 0.0200 sec t: 0.0300 sec t: 0.0400 sec t: 0.0500 sec t: 0.0600 sec t: 0.0700 sec t: 0.0800 sec t: 0.0900 sec t: 0.1000 sec x: 0.0000 m x: 0.0005 m x: 0.0020 m x: 0.0044 m x: 0.0078 mm x: 0.0123 nm x: 0.0177 m x: 0.0240 m x: 0.0314 m x: 0.0397 m x: 0.0490 m v: 0.0000 m/s v: 0.0981 m/s v: 0.1961 m/s v: 0.2942 m/s v: 0.3922 m/s v: 0.4903 m/s v: 0.5884 m/s v: 0.6864 m/s v: 0.7845 m/s v: 0.8825 m/s v: 0.9806 m/s The needed equations and constant are: v- ataa-accel. due to gravity 9.806 m/sec? round off the output to four decimal places (using setprecision)) the number of steps to take is rounded up for steps with fractional values separate your columns with tabs (i.e. It format escape sequence) 2 -use the ceil ( ) function to generate the number of time-steps so that - you will always start from t 0;v 0;x-0 initial conditions - declare the accel. due to gravity as a const double, above main )

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!