Write a program using an array of records

Assignment Help Programming Languages
Reference no: EM132211445

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 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

That's 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

Reference no: EM132211445

Questions Cloud

Write a program that reads its input into an array : Write a program that reads its input into an array and then uses selection sort to sort the array. In selection sort, we first find the smallest element.
Write a program that can be used by a small theater : Write a program that can be used by a small theater to sell tickets for performances.
Calculate team a record at the end of the season : Write a program that reads file called bballscores.txt containing the score of Team A's basketball games. The file will contain two numbers per line.
Create an array that will store input data for daily sales : Write a program using an array that will process sales data for a week. Create an array that will store input data for the daily sales for a week (7 days).
Write a program using an array of records : 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.
Write a program that reads from the external file : Write a program that reads from the external file input.txt, counts the letters in every word, replaces the word by that number, and then writes the numbers.
Write a program for displaying the deque contents : Write a program that reads in a sequence of characters and stores each character in a deque. Display the deque contents. Then use a second deque to store.
Write a program to display the count on the screen : Write a program that reads a text from the keyboard until the user presses the "Enter" key. Your program must count the number of uppercase alphabets.
Write a program that prints the number of vowels : Write a program that reads a word and prints the number of vowels and consonants in the word. For this exercise assume that 'a', 'e', 'i', 'o', 'u', and 'y'.

Reviews

Write a Review

Programming Languages Questions & Answers

  Create a subcircuit for the major parts

Design the simplest CPU that can do something slightly interesting. It will execute a small set of 16-bit instructions -  create a subcircuit for the major parts such as the register file, control, and ALU.

  Advantages and disadvantages for windows login

The Windows login can be a user or a group with users defined to the group. What do you think the advantages and disadvantages are for each type?

  Program to allot new value to first element of array

Write the single statement which assigns new value to first element of array. This new value must be equal to twice value stored in the last element of the array.

  Web design and object-oriented programming

Identify two differences between web design and object-oriented programming

  Design application to allow user to input a price

Design an application that allows a user to input a price until an appropriate sentinel value is entered.Output is the price of each item on each day,one through seven.

  Write assignment statement with one arithmetic operator

Write a simple assignment statement with one arithmetic operator in some language you know. For each component of the statement.

  Design employee objects-display each object-s yearly salary

Design two employee objects and display each object's yearly salary. Then provide each employee 10% raise and display each Employee's yearly salary again.

  Allen has been investing in the stock market for quite some

allen has been investing in the stock market for quite some time and had some success with equity investments.recently

  Determining whether it is possible to reuse code

You are a project manager and have been told that you need to reuse some given code in your new development effort. How would you go about determining whether it is possible to reuse code for this effort?

  How write the program to calculate simple matrix

How to write the program to calculate simple 3x3 spreadsheet containing integers and strings. First, input spreadsheet source values from console.

  Explain secure programming techniques

Explain secure programming techniques. The paper must have: an introduction; use empirical studies regarding insecure programming techniques.

  Case problem - ridgewood herald tribune

Complete Tutorial 10 Case Problem 2 - Ridgewood Herald Tribune found on pages 734-736 of your textbook. Complete the entire website assignment and upload your files to your 000WebHost account.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd