Question: Instructions Write a C++ program that generates a random angle in whole degree between 1 and 180. Use the rand() function and seed it using

Instructions Write a C++ program that generates a random angle in whole degree between 1 and 180. Use the rand() function and seed it using time(0) (see zyBook section 2.19). Compute the chord length subtended by this angle inside a circle of radius 2.5. Output the randomly generated angle and the chord length as shown in the two possibilities below. Note your output will likely be different depending on the random angle generated. There is no user input to this program. The 2-line output is generated every time you run the program. NOTE The function sin(angle) assumes the variable angle is given in radians, so you'll need to convert it. This requires using the constant , which is defined in the cmath library (see 2nd to last bullet point below). Your program must contain the following attributes:

Three lines of comments at the top with your name, program name, and the date created

Constant float variable storing the radius as 2.5 (2.5 should NOT appear elsewhere)

Random integer angle from 1-180 generated using rand function

Seed the random number generator using the statement srand(time(0));

Use the constant value defined in as M_PI (do not define yourself).

Set the output precision for the chord length at 4 using cout.precision(4);

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!