[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/sci/ - Science & Math


View post   

File: 259 KB, 463x462, 1294961628736.png [View same] [iqdb] [saucenao] [google]
2576024 No.2576024 [Reply] [Original]

Write a C++ program that does the following:
a. Asks the user for the distance of a target.

b. Asks the user for an angle from the horizontal that the cannon is aimed and fired.

c. Calls a void function that calculates the distance traveled, the maximum height reached, and the time traveled of the cannon ball for initial velocities of 10, 20, 30, and 40 m/s. Each of the three values (d, h, t) must be calculated using three separate single result functions.

d. Also in the void function the program checks to see if the cannon ball is within 1 meter of the target.

e. Repeats b. c. and d. for a total of 3 angles input by the user, without ending the program.

f. The void function also prints out three tables, one for each angle of the cannon to the screen and to a file named report.txt. (NOTE: This will require you to open the report.txt file above the main function so that it is globally available. If you do not, you will not be able to write all three cases of angles to the file.

g. Each table should have the following format: The table heading lists the angle and other text to identify the table columns:
Column one is the initial velocity in m/s.
Column two is the maximum height reached in meters.
Column three is the time traveled in seconds
Column four is the final distance in meters.
Column five says HIT if the ball is within 1 meter of the target and MISS if it is not.
Each table will have 4 rows (not counting the heading), one for each value of initial velocity.
Give two digits to the right of the decimal point for all outputted results.

Could someone please help me with this? I have no clue where to begin.

Thanks in advance.

>> No.2576063

Do your own homework