Question: Write a program that will read the radii of circles. Use an array of records where each record will have the radius of the circle

Write a program that will read the radii of circles. Use an array of records where each record will have the radius of the circle read from the keyboard and the Circumference and area of the circle will be calculated by the program. This information (radius, diameter and area) is stored in a binary file. The information in the binary file is then read back into the records and stored in a text output file. Left justify the information for each field.

Each record will consist of the following fields:

radius float

diameter float

area float

You may assume a maximum of 20 records. You may want to include the cmath library. You need to know the formulas for finding the area and circumference of a circle.

Sample Run:

Enter the following information:

Radius of circle:

5

Enter a Y if you would like to input more data

y

Enter the following information:

Radius of circle:

4

Enter a Y if you would like to input more data

y

Enter the following information:

Radius of circle:

7

Enter a Y if you would like to input more data

n

Thats all the information.

The output file contains the following:

Radius Area Circumference

5.00 78.54 31.42

4.00

50.27

25.13

7.00

153.94

43.98

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!