Program containing variable length groups of data

Assignment Help Biology
Reference no: EM1388414

Create a program that will read a file containing variable-length groups of data and report the average value of each group.

Begin by using a text editor to store the following data in a file named group.dat:
5 96 87 78 93 21 4 92 82 85 87 6 72 69 85 75 81 73

The data is arranged in the file so that each group of numbers is preceded by the number of data items in the group. Thus, the first number in the file, 5, indicates that the next five numbers should be grouped together. 
The number 4 then indicates that the following four numbers are a group, etc.
Write a C++ program to read the file group.dat, calculate the average of each group, and display it on the screen. [Hint: use nested loops]

Your program must do the following:
• Prompt the user and enter the filename from the console
• Open the file and confirm that the file opened correctly. If not, inform the user and continue to solicit a filename until it opens correctly or the user indicates he/she does not want to continue 
• Display the average value for each of the groups in the file

Note: Your program should work for any data file formatted in this fashion. You do not know how many groups of numbers will be included. To check this, you should create another test case with a different number of groups.
Example:
Enter filename: groups.dat
File groups.dat failed to open.
Abort? (y/n): n
Enter filename: group.dat
Group 1 has 5 numbers. Average = 75.00
Group 2 has 4 numbers. Average = 86.50
Group 3 has 6 numbers. Average = 75.83

Reference no: EM1388414

Questions Cloud

Determine the components of the force-close fitting hole : In the design of the robot to insert the small cylindrical part into a close-fitting circular hole, the robot arm must exert a 90-n force p on the part parallel to the axis of the hole as shown. Determine the components of the force which the part..
Program-compute monthly interest-print next balance for sav : Set annual interest rate to 4% then compute monthly interest and print next balance for both savers. Then set annual interest rate 5%. Compute next month interest and print next balance for both savers.
Having separate payroll departments in each division : Having separate payroll departments in each division of a divisional structure is an example of which of the following? Efficiency, because payroll departments compete.
Private health insurance-government sponsored health care : With respect to financing, Critically discuss the main differences between private health care insurance and government sponsored health care for persons over age 65 (Medicare)?
Program containing variable length groups of data : Create a program that will read a file containing variable-length groups of data and report the average value of each group.
Probability regarding the arrival of bus : Assume that a study of 500 randomly selected school bus routes showed that 480 arrived on time. Is it "significant" for a school bus to arrive late?
Ethical principles that should guide budget development : Critically discuss the ethical principles that should guide budget development? If a department is consistently going over budget, yet the department's management is sound, Discuss some of the things that could be causing the problem?
Finding possible pathways : Suppose that a series of compounds has been found in  Neurospora . Compounds A-F appear to be members of an enzyme pathway.
Examine hard-to-obtain data from two separate databases : You are interested in examining some hard-to-obtain data from two separate databases. Each database comprises numerical values - so there are 2n values total

Reviews

Write a Review

Biology Questions & Answers

  Immune response to infectious disease

It is a very curcial concept to understand how the immune response is mounted against viruses, bacteria, protozoans and helminthes. For an effective immune response, both innate and adaptive immunity should work together.

  A review on advanced glycated end products (ages)

This Project report elaborates a critical review of important elements attached to Advanced Glycated End Products (AGEs). It is very crucial to understand the process called Millard reaction.

  Plastic as a soil stabilizer

Soil stabilization is the permanent physical and chemical alteration of soils to enhance their physical properties. Stabilization can increase the shear strength of a soil and control the shrink-swell properties.

  Principles of microbiology

This assignment has three parts which contains questions related to Microbiology. It contains basic principles of microscopy, staining techniques in microbiology and microbial growth in the food industry.

  List the biologic functions

Lipid metabolites are often seen as key elements in cellular signaling. Is this unique? Please provide several examples of the function of lipids as key elements in signal arrays and list the biologic functions these signals affect?

  Biologic function relationships

Please describe how one might search for chemical structure, biologic function relationships, involving small molecular weight lipophylic compounds. Provide one example.

  Case study on patient in the haematology laboratory

Write a case study which detailing a scenario of a patient being investigated in the Haematology laboratory.

  Use of pcr and genetic approaches in biotechnology

The use of PCR and genetic approaches in biotechnology

  Describe the role of this enzyme in honey

Glucose oxidase is an enzyme that can be used for measurements of glucose levels by combining this reaction with an oxygen probe.

  Genetic problems

What phenotypic ratio would you get if you crossed a white mouse and a heterozygous brown mouse?

  Prepare an essay on nosocomial infection

Prepare an essay on nosocomial infection.

  Monitoring and recording the blood pressure

To increase the awareness of monitoring and recording the blood pressure of patients and practice measuring blood pressure in a safe environment.

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