The Task

The range R(v0, a) of a projectile fired with initial velocity v0 at an angle a is given by:

Your task in this test is to write a function to calculate the range, then to produce a table of ranges for prescribed values of velocity v0 at an angle a and finally to write the table into a file.

NB the sin function in c++ assumes an argument in radians rather than degrees. The conversion is:

a (rad) = a (deg) /180

or, in actual code, something like

a_rad = (M_PI * a_deg)/180.;

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Exercise 1. – worth 50%

This exercise involves the creation of a function structure within a program.

CalcRange(angle, velocity) etc.

6. Compile the code and run it using a test input of 20 degrees and 100 m/s. These values should return a range of 655 m